Switch between different .npmrc files with ease and grace
Switch between different .npmrc files with ease and grace.
If you use a private npm registry, you know the pain of switching between a
bunch of different .npmrc files and manually managing symlinks. Let that be a
problem no more!
npmrc is here to save the day, by making it dead simple to
switch out your .npmrc with a specific named version. It also tries to protect
you from your own stupid self by making sure you don't accidentally overwrite an
.npmrc that you actually want to keep.
npm install -g npmrc
➜ ~ npmrc --helpnpmrcSwitch between different .npmrc files with ease and grace.Usage:npmrc list all profilesnpmrc [name] change npmrc profile (uses fuzzy matching)npmrc -c [name] create a new npmrc profile called namenpmrc -r [registry] use an npm mirrorAvailable mirrors for npmrc -r:au - Australian registry mirroreu - European registry mirrorcn - Chinese registry mirrordefault - Default registry
npmrc without arguments creates an
~/.npmrcs/ directory if it doesn't exist,
and copies your current
~/.npmrc as the 'default' .npmrc profile.
➜ ~ npmrcCreating /Users/conrad/.npmrcsMaking /Users/conrad/.npmrc the default npmrc fileActivating .npmrc 'default'
➜ ~ npmrc -c newprofileRemoving old .npmrc (/home/rvagg/.npmrcs/default)Activating .npmrc 'newprofile'
A blank profile will be created. To point your profile to a non-default registry:
➜ ~ npm config set registry
npm adduser or
npm login to authenticate with the new profile.
➜ ~ npmrcAvailable npmrcs:* defaultwork
➜ ~ npmrc workRemoving old .npmrc (/Users/conrad/.npmrcs/default)Activating .npmrc 'work'
You can also pass only the first few characters of a profile and
autocomplete the profile's name.
➜ ~ npmrc defRemoving old .npmrc (/Users/conrad/.npmrcs/work)Activating .npmrc 'default'
npmrc <name> will also go to some lengths to make sure you don't overwrite
anything you might care about:
➜ ~ npmrc defaultRemoving old .npmrc (/Users/conrad/.npmrcs/work)Activating .npmrc 'default'➜ ~ npmrc defaultCurrent .npmrc (/Users/conrad/.npmrc) is already 'default' (/Users/conrad/.npmrcs/default)➜ ~ rm ~/.npmrc➜ ~ touch ~/.npmrc➜ ~ npmrc defaultCurrent .npmrc (/Users/conrad/.npmrc) is not a regular file, not removing it➜ ~ rm ~/.npmrc➜ ~ npmrc defaultActivating .npmrc 'default'
You may have to run npmrc in a shell (cmd, PowerShell, Git Bash, etc) with elevated (Administrative) privileges to get it to run.
NPMRC_STORE- Path to directory of profiles. Default:
NPMRC- Path to the npmrc file used by npm. Default:
For your convenience, you can change registries easily using the
flag. Currently we provide aliases for:
➜ ~ npm -r euUsing eu registry➜ ~ npm info npmrcnpm http GET^C➜ ~ npm -r defaultUsing default registry➜ ~ npm info npmrcnpm http GET^C
3-clause BSD. A copy is included with the source.