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

phra picture phra  路  3Comments

waygee picture waygee  路  4Comments

ghost picture ghost  路  3Comments

rangercyh picture rangercyh  路  4Comments

ldarren picture ldarren  路  3Comments