急求助,bash: npm: command not found

来源:10-2 配置 PM2 一键部署线上项目结构

woniu2015

2019-06-25

执行 pm2 deploy ecosystem.json production setup 是成功的,如下显示

[PM2] Spawning PM2 daemon with pm2_home=/Users/****/.pm2
[PM2] PM2 Successfully daemonized
--> Deploying to production environment
--> on host 47.100.161.168
  ○ hook pre-setup
  ○ running setup
  ○ cloning git@gitee.com:woshi/admin-webpack-koa-node-elementui.git
  ○ full fetch
Cloning into '/home/stm/www/it/source'...
Warning: Permanently added the RSA host key for IP address '120.55.226.24' to the list of known hosts.
  ○ hook post-setup
  ○ setup complete
--> Success

但执行 pm2 deploy ecosystem.json production报错,说找不到npm,可明明安装了

 ○ executing post-deploy `export NODE_ENV=production && npm install && pm2 startOrRestart ecosystem.json --env production`
bash: npm: command not found

  post-deploy hook failed

Deploy failed
1

服务端执行whereis npm

xxx@iZuf6ebmlb2fcric3ifZ:~$ whereis npm
npm:
xxx@iZuf6ebmlb2fcric3ifZ:~$ npm -v
6.9.0

我该怎么处理呢?急求帮助,O(∩_∩)O谢谢

写回答

1回答

woniu2015

提问者

2019-06-25

已解决

1
0

Node.js项目线上服务器部署与发布

阿里云部署Node.js+MongoDB+Nginx的应用项目,打通全栈

1747 学习 · 448 问题

查看课程