pm2 not updating NODE_ENV
I have set local and development NODE_ENV in pm2 config file. Initially I used local mode but when I tried to move from local to development mode using provided pm2 commands, it's not updating my NODE_ENV from local to development. I have tried following commands but none of them updated the NODE_ENV.
- pm2 restart app.json --env development
- pm2 reload app.json --env development
- pm2 reload app.json --update-env development
- pm2 restart app.json --update-env development
But while refreshing my page it's updating NODE_ENV. Kindly help through it may it's getting cached
--env and --update-env are two different flag that doesnt have the same behavior :
--envis used to tell pm2 to pickup the dev environment from theapp.json--update-envtell to the daemon to pickup the new environment sent by the CLI and inject it when restarting. So you need to dopm2 reload app.json --env development --update-env
Thanks @vmarchaud for the reply. I have tried your given command but still it's not injecting development mode. This works only after refreshing the page and NODE_ENV changes from local to development. I think it's getting cached and not able to update the NODE_ENV while runnning the command.
What do you mean by refreshing the page ?
My homepage which I get after starting my server
Then it might be indeed your browser that is caching the view