使用以下方法分别为npm和yarn来切换源地址,过程如下:

yarn 配置源:

// 查询源
    yarn config get registry

    // 更换国内源
    yarn config set registry https://registry.npmmirror.com

    // 恢复官方源
    yarn config set registry https://registry.yarnpkg.com

    // 删除注册表
    yarn config delete registry

npm 配置源:


	// 查询源
npm config get registry

// 更换国内源
npm config set registry https://registry.npmmirror.com

// 恢复官方源
npm config set registry https://registry.npmjs.org

// 删除注册表
npm config delete registry