ubuntu 利用pm2自动化部署nodejs服务报错:pm2 commond not found?
ubuntu 利用pm2自动化部署nodejs服务报错:pm2 commond not found?
echsystem.json 文件:
{
"apps": [
{
"name": "commic",
"script": "app.js",
"env": {
"COMMON_VARIABLE": "true"
},
"env_production": {
"NODE_ENV": "production"
}
}
],
"deploy": {
"production": {
"user": "xsy",
"host": ["120.78.165.227"],
"port": "19999",
"ref": "origin/master",
"repo": "git@gitee.com:xiasiyong/cmmic.git",
"path": "/home/xsy/www/comic/production",
"ssh_options": "StrictHostKeyChecking=no",
"post-deploy": "pm2 startOrRestart ecosystem.json --env production",
"env": {
"NODE_ENV": "production"
}
}
}
}
自己电脑上执行: pm2 deploy ecosystem.json production setup,成功
--> Deploying to production environment
--> on host 120.78.165.227
○ hook pre-setup
○ running setup
○ cloning git@gitee.com:xiasiyong/cmmic.git
○ full fetch
Cloning into '/home/xsy/www/comic/production/source'...
○ hook post-setup
○ setup complete
--> Success
发布的时候:pm2 deploy ecosystem.json production,报错
xiasiyongdeMacBook-Pro:cmmic xiasiyong$ pm2 deploy ecosystem.json production
--> Deploying to production environment
--> on host 120.78.165.227
○ deploying origin/master
○ executing pre-deploy-local
○ hook pre-deploy
○ fetching updates
○ full fetch
Fetching origin
○ resetting HEAD to origin/master
HEAD is now at de8333a 11
○ executing post-deploy `export NODE_ENV=production && pm2 startOrRestart ecosystem.json --env production`
bash: pm2: command not found
post-deploy hook failed
Deploy failed
我的服务器是阿里云,ubuntu 14.04,在服务器端运行PM2 -v 是没问题的呀?
xsy@iZwz9isotv99f3eth4ow92Z:~$ pm2 -v
2.7.2
在服务器对应的文件夹目录下面执行命令又是OK的,
小弟惭愧,折腾半天没有结果,想请教各位大神,我是哪里出问题了?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查找路径不对.
问题解决了么?怎么解决的啊?我也有这样的问题
同问,遇到同样的问题,楼主解决了吗