LinuxCommandLibrary

npmrc

TLDR

Set registry

$ registry=https://registry.npmjs.org/
copy
Set auth token
$ //registry.npmjs.org/:_authToken=[token]
copy
Set scope registry
$ @myorg:registry=https://npm.myorg.com/
copy
Save exact versions
$ save-exact=true
copy
Set default license
$ init-license=MIT
copy

SYNOPSIS

.npmrc - npm configuration file

DESCRIPTION

.npmrc files configure npm behavior. They can exist at project level, user level (~/.npmrc), or global level. Settings cascade with project taking precedence.
The file format is INI-style key=value pairs.

PARAMETERS

registry

Default registry URL.
save-exact
Save exact versions.
save-prefix
Version prefix (^, ~).
init-author-name
Default author.
init-license
Default license.
//registry/:_authToken
Registry auth token.
@scope:registry
Scope-specific registry.

FILE LOCATIONS

$ /path/to/project/.npmrc  # Project
~/.npmrc                  # User
$PREFIX/etc/npmrc         # Global
/etc/npmrc                # Built-in
copy

EXAMPLE CONFIG

$ # .npmrc
registry=https://registry.npmjs.org/
save-exact=true
@myorg:registry=https://npm.myorg.com/
//npm.myorg.com/:_authToken=${NPM_TOKEN}
copy

CAVEATS

Don't commit auth tokens. Use environment variables for secrets. Project .npmrc overrides user settings.

SEE ALSO

npm(1), npm-config(1), npm-login(1)

Copied to clipboard