centos 7.4 pm2 自动部署node 失败.....-bash: pm2: command not found
mac 下无法上传截图啊,什么鬼
在腾讯云服务器中输入命令得到一下结果
whereis pm2
pm2: /usr/bin/pm2 /usr/local/node-v6/bin/pm2
{
"apps": [{
"name": "music",
"script": "server.js",
"env": {
"COMMON_VARIABLE": "true"
},
"env_production": {
"NODE_ENV": "production"
}
}],
"deploy": {
"production": {
"user": "root",
"host": ["115.159.109.124"],
"ref": "origin/master",
"repo": "git@gitee.com:landluck/server.git",
"path": "/home/ice/production",
"ssh_options": "StrictHostKeyChecking=no",
"post-deploy" : "npm install && pm2 startOrRestart ecosystem.json --env production",
"pre-deploy-local": "echo 'Deploy Done'",
"env": {
"NODE_ENV": "production"
}
}
}
}
--> Deploying to production environment
--> on host 115.159.109.124
○ deploying origin/master
○ executing pre-deploy-local
Deploy Done
○ hook pre-deploy
○ fetching updates
○ full fetch
Fetching origin
○ resetting HEAD to origin/master
HEAD is now at 9c3f5df pm2 config
○ executing post-deploy `export NODE_ENV=production && npm install && pm2 startOrRestart ecosystem.json --env production`
npm WARN enoent ENOENT: no such file or directory, open '/home/ice/production/source/package.json'
npm WARN source No description
npm WARN source No repository field.
npm WARN source No README data
npm WARN source No license field.
bash: pm2: command not found
post-deploy hook failed
Deploy failed
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
应该是查找命令路径的问题。我也遇到了同样地问题,我是按以下方式解决的:
sudo ln -s "$NVM_DIR/versions/node/v11.8.0/bin/pm2" "/usr/local/bin/pm2"
其中"$NVM_DIR/versions/node/v11.8.0/bin/pm2"是我运行whereis pm2的得出的路径