pm2踩过的坑
Posted karila
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pm2踩过的坑相关的知识,希望对你有一定的参考价值。
pm2实现一键部署,能将github上的代码拉到服务器,但是死活就是起不了服务。
pm2部署命令:
pm2 deploy ecosystem.json production setup pm2 deploy ecosystem.json production
配置文件:
{ /** * Application configuration section * PM2 - Application Declaration */ "apps":[ // First application { "name" : "worker", "script" : "app.js", "env": { "COMMON_VARIABLE": "true" }, "env_production" : { "NODE_ENV": "production" } }, // Second application { "name" : "api-app", "script" : "api.js", } ], /** * Deployment section * PM2 - Deployment */ "deploy" : { "production" : { "user" : "root", "host" : "39.105.XX.XX", "ref" : "origin/master", "repo" : "[email protected]:kangxiaoxiao/pm2_demo.git", "path" : "/www/pm2_ex", "post-deploy" : "pm2 startOrRestart ecosystem.json --env production" } } }
CentOS7 pm2 部署node错误提示pm2: command not found]
解决办法:
whereis pm2
// pm2所在的路径(/opt/nodejs/bin/pm2)
pm2: /opt/nodejs/bin/pm2
sudo ln -s /opt/nodejs/bin/pm2 /usr/bin/pm2
原文链接:https://www.jianshu.com/p/defc3e7aa6c2
以上是关于pm2踩过的坑的主要内容,如果未能解决你的问题,请参考以下文章