global npm configuration settings

Snippet

npm has a number of configuration values you can set. While some are located in ~/.npmrc not all are. Use npm config list (or npm config ls) to see what is available:

$ npm config list
; cli configs
user-agent = "npm/2.12.1 node/v0.12.7 darwin x64"

; userconfig /Users/kitt/.npmrc
registry = "https://npm.example.com/"

; builtin config undefined
prefix = "/usr/local"

; node bin location = /usr/local/bin/node
; cwd = /Users/kitt/work/projects/twitter-project
; HOME = /Users/kitt
; 'npm config ls -l' to show all defaults.

Note that npm config list -l will show the defaults, with the overridden ones commented out:

bash-3.2$ npm config list -l
; cli configs
long = true
user-agent = "npm/2.12.1 node/v0.12.7 darwin x64"

; userconfig /Users/kitt/.npmrc
registry = "https://npm.example.com/"

; builtin config undefined
prefix = "/usr/local"

; default values
access = null
always-auth = false
bin-links = true
browser = null
ca = null
cache = "/Users/kitt/.npm"
cache-lock-retries = 10
cache-lock-stale = 60000
cache-lock-wait = 10000
cache-max = null
cache-min = 10
cafile = undefined
cert = null
color = true
depth = null
description = true
dev = false
editor = "vi"
engine-strict = false
...

I clearly need to change that editor default...

# list all npm configurations we've set
npm config list
 
# list all the settings, AND the defaults
npm config ls -l
 
# set a configuration value
npm config set registry https://npm.example.com/
 
# unset a configuration value
npm config rm registry

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.