如果在使用npm、yarn或pnpm时设置了国内镜像源,但发现设置不生效,可能有以下几个原因:
npm cache clean --force
来清除缓存。yarn cache clean
来清除缓存。pnpm cache clean
来清除缓存。npm设置
npm config set registry https://registry.npmmirror.com/(设置)
npm config get registry(查看源)
npm config set registry https://registry.npmjs.org/(切回官方源)
yarn设置
yarn config set registry https://registry.npmmirror.com(设置)
yarn config get registry(查看源)
yarn config set registry https://registry.yarnpkg.com(切回官方源)
pnpm设置
pnpm config set registry https://registry.npmmirror.com(设置)
pnpm config get registry(查看源)
pnpm config set registry https://registry.npmjs.org(切回官方源)