pm2 deploy ecosystem.json production时报错

来源:10-4 部署发布电影网站并连接线上 MongoDB

woniu2015

2018-07-11

 pm2 deploy ecosystem.json production时报错

> bcrypt@0.8.7 install /home/tihumihu/www/test/movie/source/node_modules/bcrypt

> node-gyp rebuild


/bin/sh: 1: node: not found

gyp: Call to 'node -e "require('nan')"' returned exit status 127. while trying to load binding.gyp

gyp ERR! configure error 

gyp ERR! stack Error: `gyp` failed with exit code: 1

gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:431:16)

gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)

gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)

gyp ERR! System Linux 4.4.0-93-generic

gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"

gyp ERR! cwd /home/tihumihu/www/test/movie/source/node_modules/bcrypt

gyp ERR! node -v v0.10.25

gyp ERR! node-gyp -v v0.10.10

gyp ERR! not ok 

npm WARN This failure might be due to the use of legacy binary "node"

npm WARN For further explanations, please read

/usr/share/doc/nodejs/README.Debian

 

npm ERR! weird error 1

npm ERR! not ok code 0


  post-deploy hook failed


Deploy failed


写回答

2回答

Scott

2018-07-17

恩,node 降级后,对应的 pm2 也需要装一遍,node_modules 也删除掉

0
0

Scott

2018-07-13

bcrypt 安装失败了


看上去是 node 版本这里可能也有点问题,你这样,你把 node 版本降级一下,比如安装 8.11.3,看看这个版本上能不能编译安装成功

0
1
woniu2015
我怕搞错,node降级后,npm和pm2也是需要相应的降级吧,是删了node_module,重新npm install就可以吗?求老师详细说明下。谢谢老师!
2018-07-13
共1条回复

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

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

1747 学习 · 448 问题

查看课程