设置 npm 源 和 yarn 的源
npm 查看源和换源
// 查看npm当前镜像源 npm config get registry // 设置npm镜像源为淘宝镜像 npm config set registry https://registry.npmmirror.com [--global]
yarn 查看源和换源
// 查看yarn当前镜像源 yarn config get registry // 设置yarn镜像源为淘宝镜像 yarn config set registry https://registry.npmmirror.com [--global]
如果 npm 设置不生效,可能是 .npmrc 文件一个像
如果 yarn 设置不生效,可能是 .yarnrc 文件一个像
查看 npm 的配置 .npmrc 文件
使用 npm config ls -l 命令
# npm config ls -l ; cli configs long = true metrics-registry = "https://npm.letzgo.com.cn/" scope = "" user-agent = "npm/5.6.0 node/v9.11.1 linux x64" ; project config /opt/node12/lib/node_modules/npm/.npmrc registry = "https://npm.letzgo.com.cn/" ; userconfig /root/.npmrc registry = "https://npm.letzgo.com.cn/" ; globalconfig /usr/local/node/etc/npmrc disturl = "https://npm.taobao.org/dist" registry = "https://npm.letzgo.com.cn/" ; default values access = null allow-same-version = false also = null always-auth = false auth-type = "legacy" bin-links = true browser = null ca = null cache = "/root/.npm" cache-lock-retries = 10 cache-lock-stale = 60000 cache-lock-wait = 10000 ...
查看 yarn 的配置 .yarnrc文件
使用 yarn config list --verbose 命令
# yarn config list --verbose yarn config v1.22.4 verbose 0.246 Checking for configuration file "/opt/node12/lib/node_modules/npm/.npmrc". verbose 0.247 Found configuration file "/opt/node12/lib/node_modules/npm/.npmrc". verbose 0.247 Checking for configuration file "/usr/local/share/.npmrc". verbose 0.247 Checking for configuration file "/usr/local/node/etc/npmrc". verbose 0.247 Found configuration file "/usr/local/node/etc/npmrc". verbose 0.248 Checking for configuration file "/root/.npmrc". verbose 0.248 Found configuration file "/root/.npmrc". verbose 0.248 Checking for configuration file "/opt/node12/lib/node_modules/npm/.npmrc". verbose 0.249 Found configuration file "/opt/node12/lib/node_modules/npm/.npmrc". verbose 0.249 Checking for configuration file "/opt/node12/lib/node_modules/.npmrc". verbose 0.249 Checking for configuration file "/opt/node12/lib/.npmrc". verbose 0.249 Checking for configuration file "/opt/node12/.npmrc". verbose 0.249 Checking for configuration file "/opt/.npmrc". verbose 0.252 Checking for configuration file "/opt/node12/lib/node_modules/npm/.yarnrc". verbose 0.252 Checking for configuration file "/usr/local/share/.yarnrc". verbose 0.252 Found configuration file "/usr/local/share/.yarnrc". verbose 0.252 Checking for configuration file "/usr/local/node/etc/yarnrc". verbose 0.252 Checking for configuration file "/root/.yarnrc". verbose 0.252 Checking for configuration file "/opt/node12/lib/node_modules/npm/.yarnrc". verbose 0.253 Checking for configuration file "/opt/node12/lib/node_modules/.yarnrc". verbose 0.253 Checking for configuration file "/opt/node12/lib/.yarnrc". verbose 0.253 Checking for configuration file "/opt/node12/.yarnrc". verbose 0.253 Checking for configuration file "/opt/.yarnrc". verbose 0.28 current time: 2023-08-08T06:08:23.118Z
0顶
0 踩
共 0 条评论