Forever with npm start and environment variable

佐手、 提交于 2019-12-24 03:13:10

问题


I used to start my application using:

DEBUG=chakka ENVIRONMENT=production npm start

How can i start it using forever so i wouldn't have to do it everytime i want to test the application? Thanks!


回答1:


First you need to know what the application's main script file is. Open up your package.json file and find out what the start script is. If you're using Express it might be app.js. So we'll assume app.js for this example, replace with whatever your file is.

To start the application:

DEBUG=chakka ENVIRONMENT=production forever start app.js

to restart the application after you've made changes:

forever restart app.js


来源:https://stackoverflow.com/questions/26773936/forever-with-npm-start-and-environment-variable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!