Node.js · Junior · Question 48 of 75
How can Node.js load variables from a .env file without extra packages?
- 1Node.js reads
.envautomatically on every start - ✓Correct answer:
node --env-file=.env app.js(orprocess.loadEnvFile()) - 3It's not possible; you must install
dotenv
Explanation
Built-in .env support removed the need for dotenv in many projects. Real secrets in production still come from the environment or a secret manager, not a committed file.