Method 1: Temporary use
npm --registry https://registry.npm.taobao.org install xxx
Copy the code
Method two: Permanent use
npm config set registry https://registry.npm.taobao.org
Copy the code
You can perform the following steps to verify the configuration
npm config get registry
Copy the code
or
npm info xxx
Copy the code
Method 3: Use CNPM
npm install -g cnpm --registry=https://registry.npm.taobao.org
Copy the code
After the statement is executed, the package can be installed through CNPM
cnpm install xxx
Copy the code
Finally, cancel taobao mirror
npm config set registry https://registry.npmjs.org/
Copy the code