You have to set the NODE_ENV
variable on the command line when you execute your NodeJS application.
For example:
NODE_ENV=production node app.js
Also, NODE_ENV
is an environment variable so if set it in the environment on your server, you will not need to provide it every time you execute your application so node app.js
will do.
You can set your environment variables in the /etc/environment
file. Here are more details on that.