javascriptnode.jsdeploymentforeverreact-boilerplate

How to run React Boilerplate with forever


I'm going to run react-boilerplate application forever in the server. I found forever and I'm not sure how I pass parameters to forever. The command to run server is like following:

PORT=80 npm run start:production

Seems like forever start PORT=80 npm run start:production doesn't help me.


Solution

  • One thing is that PORT=80 part is setting the env variable, this kind of command should be in front of other commands. The other thing is that to run npm scripts with forever, you need to use different syntax, so PORT=80 forever start -c "npm run start:production" /path/to/app/dir/.

    If you're running forever form the project folder, the path should be ./