What is the method for setting up a mirror for npm?

There are several ways to set up an npm mirror.

  1. Set the image using the command line: You can set the image using the following command:
npm config set registry <registry-url>

indicates the address of the image you want to use, such as the address of the Taobao mirror: https://registry.npm.taobao.org/.

  1. Configuration file for npm
  2. The npm configuration file.
registry=<registry-url>

Similarly, is the address of the image you want to use.

  1. Previous.
  2. – Natural Resource Management
  3. I love it
npm install -g nrm
nrm use <registry-name>

In this case, represents the name of the image you want to use, for example taobao represents the Taobao image.

No matter which method you use to set up a mirror, when running commands such as npm install, npm will download dependencies from the specified mirror address.

bannerAds