切换npm源的几种方法
    		       		warning:
    		            这篇文章距离上次修改已过441天,其中的内容可能已经有所变动。
    		        
        		                
                切换npm源可以通过以下几种方法实现:
- 命令行临时使用其他源:
 
npm install --registry https://registry.npm.taobao.org- 使用
nrm工具来管理和切换源: 
# 安装nrm
npm install -g nrm
 
# 列出可用源
nrm ls
 
# 切换到taobao源
nrm use taobao- 修改
.npmrc文件: 
echo 'registry=https://registry.npm.taobao.org' >> ~/.npmrc- 使用npm的配置命令:
 
npm config set registry https://registry.npm.taobao.org- 使用
yarn的配置命令(如果你使用yarn): 
yarn config set registry https://registry.npm.taobao.org记得替换https://registry.npm.taobao.org为你想要切换到的npm源地址。
评论已关闭