I am installing PM2 for hubot rocket.chat adapter. so i did the following:
I firstly added a file to hubot adapter folder, then
sudo npm install pm2 -g
cd <hubot directory>
pm2 start <pm2.json>
The i got error saying this:
No command 'pm2' found, did you mean:
Command 'wm2' from package 'wm2' (universe)
Command 'pms' from package 'pms' (universe)
Command 'pmk' from package 'pmk' (universe)
Command 'pmw' from package 'pmw' (universe)
Command 'fpm2' from package 'fpm2' (universe)
Command 'pom2' from package 'libpod-pom-perl' (universe)
Command 'pmi' from package 'powermanagement-interface' (universe)
Command 'pm' from package 'powerman' (universe)
pm2: command not found
Then I tried to add the path by doing:
sudo env PATH=$PATH:/home/jy/.npm-global/bin pm2 startup -u safeuser
and
export PATH=$PATH:/home/jy/.npm-global/bin
and restarted PuTTY,
still get the same error.
when I went to where PM2 is at, which is /home/jy/.npm-global/bin, and do pm2 start <pm2.json> command, still get the same error.
Is there anything i did wrong? or there might be other reasons?
The problem is that you are running NPM as sudo, so you will only be able to access it using:
sudo pm2 start server.js
Install without sudo, you may even install without the -g flag and call it directly from node_modules directory. This may be useful if you do not have root (admin) privileges in the machine you're working on.
npm install pm2
./node_modules/.bin/pm2 start server.js
Source: https://stackoverflow.com/a/40812333/1052581
Related
I am trying to install WordPress in my ubuntu 16.04 which requires MySQL while going with the process I am getting this every time after spending hours on this I still can't find the solution and while checking the MySQL it shows it is already installed.
#root :~$ mysql -u root -p
No command 'mysql' found, did you mean:
Command 'mysqld' from package 'percona-server-server-5.6' (universe)
Command 'mysqld' from package 'percona-xtradb-cluster-server-5.6' (universe)
Command 'mysqld' from package 'mariadb-server-core-10.0' (universe)
Command 'mysqld' from package 'mysql-server-core-5.7' (main)
Command 'mysql' from package 'mysql-client-core-5.7' (main)
Command 'mysql' from package 'mariadb-client-core-10.0' (universe)
#root:~$ mysql: command not found
Have you installed?
sudo apt install mysql
You can check installed packages using
sudo apt list | grep mysql
setup: i3wm, fedora 31
I am facing this issue, in which some rpm's even after being installed,
For e.g. I have Bluejeans installed, but when I try running the app, it results in command not found, the baffling part being I have no such issue opening it in gnome.
$ rpm -qa | grep -i bluejeans
bluejeans-v2-2.0.0-188.x86_64
$ bluejeans
zsh: bluejeans: command not found...
same goes when I try accessing using dmenu.
solved the issue, bluejeans was not getting installed in /usr/bin or any other similar paths.
rpm -ql bluejeans
package bluejeans is not installed
while they also named package as bluejeans-v2 which made it harder to search, while in gnome I could start using bluejeans even from the terminal.
solution:
create a symlink to /usr/bin where you have bluejean-v2 installed
ls -s /usr/bin/bluejean-v2 ${install_path}/bluejeans-v2
I am trying to deploy my functions on the cloud functions emulator but my terminal throws me this error:
$ functions deploy sendNotifications --trigger-http
{ Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/#google-cloud/functions-emulator/logs'
at Error (native)
at Object.fs.mkdirSync (fs.js:922:18)
at Object.assertLogsPath (/usr/local/lib/node_modules/#google-cloud/functions-emulator/src/emulator/logs.js:31:10)
at new Controller (/usr/local/lib/node_modules/#google-cloud/functions-emulator/src/cli/controller.js:84:32)
at Object.exports.handler (/usr/local/lib/node_modules/#google-cloud/functions-emulator/src/cli/commands/deploy.js:124:22)
at Object.self.runCommand (/usr/local/lib/node_modules/#google-cloud/functions-emulator/node_modules/yargs/lib/command.js:231:22)
at Object.Yargs.self._parseArgs (/usr/local/lib/node_modules/#google-cloud/functions-emulator/node_modules/yargs/yargs.js:989:30)
at Object.Yargs.self.parse (/usr/local/lib/node_modules/#google-cloud/functions-emulator/node_modules/yargs/yargs.js:533:23)
at Object.main (/usr/local/lib/node_modules/#google-cloud/functions-emulator/src/cli/main.js:69:6)
at getProjectId.then (/usr/local/lib/node_modules/#google-cloud/functions-emulator/bin/functions:100:27)
errno: -13, code: 'EACCES', syscall: 'mkdir', path:
'/usr/local/lib/node_modules/#google-cloud/functions-emulator/logs' }
I have cd-ed to the functions directory and checked that I am logged in to firebase and selected the right project Id. Am i doing something wrongly?
Overview
The proper way to fix this is by changing the npm global directory to one that does not require root permission to install and run.
You really should not be requiring sudo to npm install -g.
Likewise to functions start.
Cleansing
Given that you have installed functions, presumably using sudo npm install -g #google-cloud/functions-emulator, you now need to first uninstall it equally with sudo: sudo npm uninstall -g #google-cloud/functions-emulator.
Why uninstall it? You currently have functions installed into a directory where root permissions are required to write. It does require write permission to log file as you can see from the error.
I would suggest uninstalling the other npm packages which you may have installed using sudo, except npm. You can find out what you have using sudo npm list -g --depth=0.
Changing npm global directory
I would suggest going with Option 2 described on https://docs.npmjs.com/getting-started/fixing-npm-permissions
Copy pasting solution from link above:
Make a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
Open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
Back on the command line, update your system variables:
source ~/.profile
Install global without sudo
Now that your machine has been cleansed and npm global has been configured to a directory that does not require root permissions, you should be able to install and run without sudo.
Had the same issue. For me it did not showed the permission log also..The issues is with the permissions. Try to the command with super user.
Step 1.
Start the gcloud functions
sudo functions start
Step 2.
Deploy the helloworld function which was exported.
sudo functions deploy helloworld --trigger-http
This is obviously very late for the original post. Hope this helps other who has the same error in the future.
I had the same issue turn out I hadn't installed that the requirements properly. Any one who steps in here can look at Error: EACCES: permission denied #195.
Main note of this error install all requirements properly.
I tried installing gulp via cmd on my mac but and used
nmp install gulp-cli --global
but couldn't install, instead it throws a permission denied error as show in the image below. Any suggestions?
http://i.stack.imgur.com/dO91r.png
It's all about permission problem. You can try,
sudo npm install -g gulp-cli--global --allow-root
Trying to test compoundjs with mysql but it fails.
My system is Debian 7 with following versions of nodejs & npm
$ node -v
v0.10.13
$ npm -v
1.3.4
Here is how I installed compoundjs
sudo npm install -g compound
sudo npm install -g jugglingdb --save
sudo npm install -g jugglingdb-mysql
compound init testapp --db mysql
cd testapp
npm install
$ node server.js
WARNING: JugglingDB adapter "mysql" is not installed,
so your models would not work, to fix run:
npm install jugglingdb-mysql
/srv/www/playground/node/testapp/node_modules/jugglingdb/lib/railway.js:55
if (!schema.adapter) throw new Error('Adapter is not defined');
^
Error: Adapter is not defined
at init (/srv/www/playground/node/testapp/node_modules/jugglingdb/lib/railway.js:55:36)
at CompoundServer.initialize (/srv/www/playground/node/testapp/node_modules/jugglingdb/index.js:31:19)
at CompoundServer.EventEmitter.emit (events.js:98:17)
at CompoundServer.initCompound (/srv/www/playground/node/testapp/node_modules/compound/lib/compound.js:123:14)
at CompoundServer.initCompoundServer [as init] (/srv/www/playground/node/testapp/node_modules/compound/lib/server/compound.js:53:29)
at /srv/www/playground/node/testapp/node_modules/compound/lib/compound.js:67:18
at process._tickCallback (node.js:415:13)
at Function.Module.runMain (module.js:499:11)
at startup (node.js:119:16)
at node.js:901:3
After getting the error above I tried
npm install jugglingdb-mysql
I still get the same error. I have tried installing jugglingdb and jugglingdb-mysql globally and locally (without -g). I keep getting the same error.
The bug is due to the jugglingdb version used in the npm deposit of jugglingdb-mysql, so the only way to fix it is to delete the directory and copy the one you use in your main project :
cd $YOUR_PROJECT_ROOT
rm -rf node_modules/jugglingdb-mysql/node_modules/jugglingdb
cp -R node_modules/jugglingdb node_modules/jugglingdb-mysql/node_modules
I haven't tries to install the adapter manually from github, maybe it works too.
The problem is reported here https://github.com/jugglingdb/mysql-adapter/issues/46