使 nodejs 代码 在后端运行(forever)

mac2022-06-30  21

情境

运行nodejs的程序,使用命令:node xxx.js,但是关掉终端,程序也关闭了,如何让node app的程序一直运行?

解决

1.安装forever

npm install -g forever

2.使用forever开启nodejs程序

forever start xxx.js

如果你需要用npm start来运行你的程序,则用命令forever start -c “npm start” 路径

3.如果不需要一直运行nodejs程序

forever stop xxx.js

.

转载于:https://www.cnblogs.com/crazycode2/p/11286309.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)