Environment & Config in NPM
From the NPM Package Manager cheat sheet ยท Scripts & Task Running ยท verified Jul 2026
Environment & Config
Configure NPM behavior and environment
bash
# View config
npm config list
npm config get registry
# Set config
npm config set registry https://registry.npmjs.org/
npm config set save-exact true
# Delete config
npm config delete save-exact
# Edit config file
npm config edit
# Set for current command only
npm install --registry http://localhost:4873
# Environment variables
NODE_ENV=production npm run build
npm_config_production=true npm install๐ก Project .npmrc overrides user config
๐ Use npm config for persistent settings
โ ๏ธ Don't commit auth tokens to .npmrc
๐ข Essential for CI/CD and private registries
๐ Related: dotenv for environment variables
configenvironment