Pm2: process.env.NODE_ENV not set passing value from terminal?

Created on 6 Sep 2018  路  1Comment  路  Source: Unitech/pm2

What's going wrong?

I have an express.js app, my console.log(process.env.NODE_ENV) got undefined when I start my node server using pm2
I tried both commands below

NODE_ENV=production pm2 start server
pm2 start server --env production

I tried normal startup with node like NODE_ENV=production node server.js I can see the console.log(process.env.NODE_ENV) is correct.

Most helpful comment

Ok, my bad, I have to kill my app first: pm2 kill

>All comments

Ok, my bad, I have to kill my app first: pm2 kill

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rajendar38 picture rajendar38  路  3Comments

shaunwarman picture shaunwarman  路  3Comments

xzycn picture xzycn  路  3Comments

getvega picture getvega  路  3Comments

phra picture phra  路  3Comments