目录

NodeJS配置镜像仓局

目录

NodeJS配置镜像仓局

npm

vim   user_home/.npmrc

# 方式一

# 以@ul开头的包 使用内网仓局
@ul:registry=http://192.168.10.120:4873 

# 其它包使用淘宝镜像源
registry=https://registry.npmmirror.com



# 方式二
npm config set @ul:registry http://192.168.10.120:4873
npm config set  registry=https://registry.npmmirror.com


# 检查配置
npm config list

yarn

# 方式一
vim   user_home/.yarnrc

registry "https://registry.npmmirror.com"
npmScopes:
  ul:
    npmRegistryServer: "http://192.168.10.120:4873"
    npmAuthToken: "你的Token"  # 如果有 Token


# 方式二
yarn config set registry "https://registry.npmmirror.com"
yarn config set npmScopes.ul.npmRegistryServer "http://192.168.10.120:4873"


# 检查配置
yarn config list