starting node forever script with PORT=XXXX

10,047

Solution 1

PORT=1234 forever start app.js 

Solution 2

PORT=1234 forever start app.js 

Unfortunately that didn't work for me, so I tried this and it works:

forever start app.js --port 1234 

Solution 3

You can try adding export PORT=1234 to app.js Then just run with forever start app.js

Share:
10,047
Kristian
Author by

Kristian

I'm a former developer turned product manager working at AWS in Seattle.

Updated on June 11, 2022

Comments

  • Kristian
    Kristian almost 2 years

    when running node in command over a specific port, I'd start the app this way:

    PORT=1234 node app.js
    

    how do I pass the port to the forever command? no matter what I try, it seems to not want to work.

    I've tried:

    • passing the port as an arg: forever start app.js 1234
    • passing the port declaration as an arg: forever start app.js PORT=1234