background

Due to the surging usage of old Taobao NPM source, Taobao business domain name is no longer in line with the trend, and the old CNPM core is old and other reasons, the official decision is to switch to a new domain name and improve the CNPM core:

npmmirror.com

Deadline:

In May 2022

At present, the old Taobao source (registry.npm.taobao.org) has been 301 to the new domain name, and the project also needs to be reformed.

solution

Use npmMirror-quick to quickly solve the source switching problem:

  yarn global add npmmirror-quick
  Execute in the project root directory
  nq
Copy the code

The tool does three things for you:

  1. Update global configuration: Update global NPM/YARN/PNPM Registry Settings to the new Taobao source

  2. Update.npmrc: If the project contains.npmrc registry configuration, update it to the new Taobao source

  3. Update lock file: Update the old Taobao link in the dependent locking file of the project (no package-lock.json/yarn.lock/pnpm-lock.yaml, support monorepo independent locking file) to replace the new Taobao source link

After updating the lock file, remove node_modules and re-install dependencies to ensure that all dependencies are downloaded correctly