npm config set <key> <value> npm config get <key> npm config delete <key> npm config list
The config command is a way to interact with the
.npmrc file. This file is a
JSON encoded list of values that npm is concerned with. The first time you run
npm, it will create a conf file filled with default values.
On exit, the current state of the config is always saved, so that any changes will be recorded. You may safely modify the file (as long as it's still parseable JSON), but it is safer to use the npm config commands.
Config supports the following sub-commands:
npm config set key value
Sets the config key to the value.
npm config get key
Echo the config value to stdout. (NOTE: All the other npm logging is done to
stderr, so pipes should work properly, and you can do
npm get key 2>/dev/null
to print out JUST the config value.)
npm config list
Show all the config settings.
FIXME: Prints to stderr, but should really be stdout, since the log is what you're after.
npm config delete key
Deletes the key from the configuration file.
Automatically activate a package after installation, if there is not an active version already. Set to "always" to always activate when installing.
The root folder where packages are installed and npm keeps its data.
The base URL of the npm package registry.
A base-64 encoded "user:pass" pair.
FIXME: This is not encoded in any kind of security sense. It's just base-64
encoded strictly so that it can be sent along the wire with HTTP Basic
authentication. An upcoming version of npm will encrypt this and save it back
to the registry as
auth-crypt, which will be quite a bit more secure. Until
then, use a unique password that you don't mind being compromised.