我尝试了这个solution,但我仍然遇到同样的问题。
yarn global add pm2
->确定
sudo pm2 status
-> sudo: pm2: command not found
pm2 status
-> -bash: pm2: command not found
在我的~/.bashrc
中,添加以下行:
export PATH=$PATH:usr/bin/pm2
因为whereis pm2
返回了/usr/bin/pm2
,但没有任何变化
我也测试了此路径:yarn bin
-> /home/user/node_modules/.bin
,但是也没有
答案 0 :(得分:0)
解决方案:
find * -name "pm2"
我有几行:
home/myUser/.config/yarn/global/node_modules/pm2
home/myUser/.config/yarn/global/node_modules/pm2/pm2
home/myUser/.config/yarn/global/node_modules/pm2/bin/pm2
home/myUser/.config/yarn/global/node_modules/pm2/lib/templates/logrotate.d/pm2
home/myUser/.config/yarn/global/node_modules/.bin/pm2
home/myUser/.cache/yarn/v6/npm-pm2-4.1.2-97f852c731d307a60dde1ef2fc5a622813ab6cf4-integrity/node_modules/pm2
home/myUser/.cache/yarn/v6/npm-pm2-4.1.2-97f852c731d307a60dde1ef2fc5a622813ab6cf4-integrity/node_modules/pm2/pm2
home/myUser/.cache/yarn/v6/npm-pm2-4.1.2-97f852c731d307a60dde1ef2fc5a622813ab6cf4-integrity/node_modules/pm2/bin/pm2
home/myUser/.cache/yarn/v6/npm-pm2-4.1.2-97f852c731d307a60dde1ef2fc5a622813ab6cf4-integrity/node_modules/pm2/.bin/pm2
home/myUser/.cache/yarn/v6/npm-pm2-4.1.2-97f852c731d307a60dde1ef2fc5a622813ab6cf4-integrity/node_modules/pm2/lib/templates/logrotate.d/pm2
home/myUser/.yarn/bin/pm2
我每个人都测试一次:
home/myUser/.yarn/bin/pm2 ls
一项工作:home/myUser/.yarn/bin/pm2
所以我用export PATH=$PATH:home/myUser/.yarn/bin/
编辑我的bashrc
并测试:
xxxxx@xxxxx:/$ pm2 ls
┌────┬─────────────────────────┬─────────┬─────────┬──────────┬────────┬──────┬──────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├────┼─────────────────────────┼─────────┼─────────┼──────────┼────────┼──────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│ 1 │ main │ 0.0.1 │ fork │ 15499 │ 44s │ 136 │ online │ 0.2% │ 76.3mb │ xxxxx │ disabled │
│ 2 │ main │ 0.0.1 │ fork │ 15470 │ 59s │ 29 │ online │ 0.2% │ 77.3mb │ xxxxx │ disabled │
│ 0 │ node │ N/A │ fork │ 0 │ 0 │ 60 │ errored │ 0% │ 0b │ xxxxx │ disabled │
└────┴─────────────────────────┴─────────┴─────────┴──────────┴────────┴──────┴──────────┴──────────┴──────────┴──────────┴──────────┘