How to configure npm with npmrc?
In this article, we will discuss the basics of npm configuration file called npmrc and the various ways npmrc can be configured.
One of the most important features of the npm CLI is that its highly configurable. NPM provides an great levels of configurability that enables everyone from huge enterprises to individual developers to use it effectively.
One thing that enables this high-configurability is the .npmrc file. .npmrc is the configuration file that npm allows to be used globally or user level or project level to optimize your npm environment.
npmrc can be configured in four different locations
- Per user
- Per project
Global npmrc located at /etc/npmrc is a list of key-values which might be used like environment variables
Per user npmrc
You can configure user-level npmrc by creating a .npmrc file under the home directory.
Per project npmrc
This can be configured at the root of your project which applies only for your project
This is an unchangeable npm configuration which keeps npm consistent.
We have already discussed how to congifure npmrc with a private repository.