Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forever with npm start and environment variable

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!

like image 274
Code Diary Avatar asked Mar 17 '26 11:03

Code Diary


1 Answers

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
like image 124
Daniel Avatar answered Mar 20 '26 07:03

Daniel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!