[英]Run node as a service with pm2
I am trying to run a node api as a service but when I run the following command我正在尝试将节点 api 作为服务运行,但是当我运行以下命令时
C:\Windows\System32>pm2-service-install -n 0PM2
it asks the following question它问了以下问题
Perform environment setup (recommended)?
I put yes but it stays there and does nothing我说是,但它一直呆在那里,什么也不做
What could be the problem?可能是什么问题呢?
You can simply install the pm2
package.您可以简单地安装pm2
包。
npm install pm2 -g
Run the module that has your server运行有你的服务器的模块
pm2 start app.js
If the above things are working fine, it shows your installation and configuration are correct.如果以上一切正常,则表明您的安装和配置是正确的。 Now, use pm2
commands:现在,使用pm2
命令:
pm2 startup
follow the command from the o/p of above command按照上述命令的 o/p 中的命令
pm2 save
It seems you are using windows, you should use these steps:看来您正在使用 Windows,您应该使用以下步骤:
pm2-installer
from here .从这里下载pm2-installer
。npm run setup
npm run configure
npm run setup
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.