I\'m trying to follow a tutorial on NodeJs. I don\'t think I missed anything but whenever I call the process.env.NODE_ENV the only value I get back is undefine
For me, the issue was that I was using the pkg library to turn my app into an executable binary. In that case, the accepted solutions didn't work. However, using the following code solved my problem:
const NODE_ENV = (process).pkg ? 'production' : process.env.NODE_ENV;
I found this solution here on GitHub.