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

Continue with NPM Package Manager

Save the full cheat sheet or work through every related task.

More NPM tasks

Back to the full NPM Package Manager cheat sheet