npm一键配置-源更换、代理配置,解决npm安装慢问题

linux 安装

tar -zvxf node-v14.tar.gz

ln -s /node-v14/bin/npm /usr/bin/npm
ln -s /node-v14/bin/npm /usr/local/bin/npm

查看 npm 配置

npm config list

代理设置

npm config set proxy=http://127.0.0.1:8087
npm config set https-proxy http://127.0.0.1:8087

// 需要用户名和密码
npm config set proxy http://username:password@server:port
npm confit set https-proxy http://username:password@server:port

// 取消代理
npm config delete proxy
npm config delete https-proxy

npm 安装设置

npm config set strict-ssl false // SSL错误

npm config get registry // 查看当前源
npm config set registry https://registry.npmmirror.com/  // 设置淘宝源(已更新)
npm config set registry https://registry.npmjs.org/  // 设置官方源

npm config set sass_binary_site https://registry.npmmirror.com/mirrors/node-sass/
npm config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver
npm config set electron_mirror https://registry.npmmirror.com/mirrors/electron/

yarn config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver
yarn config set electron_mirror https://registry.npmmirror.com/mirrors/electron/
yarn config set registry https://registry.npmmirror.com//
yarn config set registry https://registry.yarnpkg.com
yarn config set sass_binary_site https://registry.npmmirror.com/mirrors/node-sass/
yarn config set phantomjs_cdnurl http://cnpmjs.org/downloads
yarn config set sqlite3_binary_host_mirror https://foxgis.oss-cn-shanghai.aliyuncs.com/
yarn config set profiler_binary_host_mirror https://registry.npmmirror.com/mirrors/node-inspector/

淘宝源已更新成:https://registry.npmmirror.com/

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值