Mac os Catalina 10.15.5 / npm version 6.14.5
When I install pm2, it seems that it is being installed without any problem. But if I run pm2, the terminal only says that command not found. It's not working at all. It just doesn't start.
I searched through StackOverflow and tried the following solutions.
- npm i -g pm2
- sudo npm install -g pm2
- npm i pm2@latest --no-optional -g --no-shrinkwrap
- sudo npm install pm2 -g --unsafe-perm
All of the above gives me this result.
/Users/myname/.npm-global/bin/pm2 -> /Users/myname/.npm-global/lib/node_modules/pm2/bin/pm2
/Users/myname/.npm-global/bin/pm2-docker -> /Users/myname/.npm-global/lib/node_modules/pm2/bin/pm2-docker
/Users/myname/.npm-global/bin/pm2-dev -> /Users/myname/.npm-global/lib/node_modules/pm2/bin/pm2-dev
/Users/myname/.npm-global/bin/pm2-runtime -> /Users/myname/.npm-global/lib/node_modules/pm2/bin/pm2-runtime
+ pm2@4.4.0
updated 1 package in 4.768s
After this,
If I type pm2
: I get pm2-bash: pm2: command not found
If I type whereis pm2
: it just doesn't do anything at all.
If I type pm2 start index.js
in VScode terminal: zsh: command not found: pm2
And there are the files inside of the path( /Users/myname/.npm-global/bin/
). I don't know what the problem is. Any help or advice will be appreciated.
those who are having the same problem, hope it helps. After repeating countless uninstall & install of node/npm/pm2 whatsoever and toying around the permissions, I found answer by myself.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.