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.
Ok, my bad, I have to kill my app first: pm2 kill
Most helpful comment
Ok, my bad, I have to kill my app first:
pm2 kill