Node.js
Environment Commands
Configure Node.js runtime behavior with environment variables and flags. Manage NODE_ENV, enable experimental features, and control memory, threading, and network settings.
6 commands
Pro Tips
Use '--env-file=.env' (Node 20+) to load environment variables natively — no dotenv package needed.
Set 'NODE_OPTIONS="--max-old-space-size=4096"' to apply flags globally without modifying scripts.
Use 'NODE_ENV=production' in production — many frameworks optimize behavior and disable debug features.
Common Mistakes
Never store secrets in .env files committed to git. Use .env.local (gitignored) or a secrets manager.
NODE_OPTIONS applies to ALL node processes including build tools. Overly aggressive flags can break tools.