NODE_ENV

An environment variable, usually set to production or development, that libraries, frameworks and build tools read to switch behaviour.

In more detail

Node.js itself ignores it; frameworks such as Express use it to switch off debugging output and switch on caching. Bundlers replace process.env.NODE_ENV with a literal value, so development-only code such as extra warnings is stripped from production bundles. Keep it the same in every deployed environment so tests behave like production.

Related terms

Taught in

References