Setting the environment variable

I’m using Windows 10, still and If I:
console.log(NODE_ENV: ${process.env.NODE_ENV});
The output is:
NODE_ENV: undefined
after I set NODE_ENV to production on the command line:
set NODE_ENV=production
Is it the server not recognizing the environment variable or the app?

After setting the environment variable with NODE_ENV=production, you need to run your server like so:

export NODE_ENV=production & node index.js
1 Like


I had same problem, this solved my issues. I am talking about windows only.