use*_*755 2 amazon-web-services pm2
我已经使用以下命令安装了 pm2
npm install pm2@latest -g
这工作正常,我现在正在运行使用 pm2 的生产服务。
我退出了 shell ( AWS ),现在如果我尝试,pm2 list我会收到错误:-
pm2: command not found
我认为问题可能是我应该跑sudo npm install pm2@latest -g
从之前的 stackoverflow 答案中我可以看到这是建议的方法,但我的问题是......
如果我现在运行,sudo npm install pm2@latest -g这会影响我当前运行的 pm2 服务吗?
谢谢
小智 6
我相信问题是您没有将 npm 全局目录添加到您的销售路径中
检查本指南: https ://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md
TLDR:您想要做的是通过执行来获取您的 npm 前缀目录
npm config get prefix
那么你的 pm2 就在<YOUR_NPM_PREFIX>/bin/pm2
要将你的 npm 全局用户目录添加到你的 shell 中PATH,你可以输入这个命令
export PATH="$PATH:<YOUR_NPM_PREFIX>/bin"
在你的 中 .bashrc,不要忘记重新登录你的 shell 或者source ~/.bashrc如果你正在使用 bash
| 归档时间: |
|
| 查看次数: |
3561 次 |
| 最近记录: |