yarn和npm设置国内镜像源

Terwer 前端开发评论772字数 1637阅读5分27秒阅读模式

2022-08-16 feat:更新最新镜像地址。文章源自浅海拾贝-https://blog.terwergreen.com/yarn-and-npm-set-up-domestic-mirror-sources-zocffa.html

由于 npm 包部分依赖下载速度缓慢,最好使用国内镜像源来解决,一般使用淘宝开源的镜像。文章源自浅海拾贝-https://blog.terwergreen.com/yarn-and-npm-set-up-domestic-mirror-sources-zocffa.html

安装 yarn

npm i -g yarn

yarn 设置国内源

yarn config set registry https://registry.npmmirror.com/ --global  && \
yarn config set disturl https://npmmirror.com/package/dist --global && \
yarn config set sass_binary_site https://cdn.npmmirror.com/binaries/node-sass --global  && \
yarn config set electron_mirror https://registry.npmmirror.com/binary.html?path=electron/ --global  && \
yarn config set puppeteer_download_host https://registry.npmmirror.com/binary.html --global  && \
yarn config set chromedriver_cdnurl https://cdn.npmmirror.com/binaries/chromedriver --global  && \
yarn config set operadriver_cdnurl https://cdn.npmmirror.com/binaries/operadriver --global  && \
yarn config set phantomjs_cdnurl https://cdn.npmmirror.com/binaries/phantomjs --global  && \
yarn config set selenium_cdnurl https://cdn.npmmirror.com/binaries/selenium --global  && \
yarn config set node_inspector_cdnurl https://cdn.npmmirror.com/binaries/node-inspector --global

npm 设置国内源

npm set registry https://registry.npmmirror.com/ && \
npm set disturl https://npmmirror.com/package/dist && \
npm set sass_binary_site https://cdn.npmmirror.com/binaries/node-sass && \
npm set electron_mirror https://registry.npmmirror.com/binary.html?path=electron/ && \
npm set puppeteer_download_host https://registry.npmmirror.com/binary.html && \
npm set chromedriver_cdnurl https://cdn.npmmirror.com/binaries/chromedriver && \
npm set operadriver_cdnurl https://cdn.npmmirror.com/binaries/operadriver && \
npm set phantomjs_cdnurl https://cdn.npmmirror.com/binaries/phantomjs && \
npm set selenium_cdnurl https://cdn.npmmirror.com/binaries/selenium && \
npm set node_inspector_cdnurl https://cdn.npmmirror.com/binaries/node-inspector && \
npm cache clean --force

文章源自浅海拾贝-https://blog.terwergreen.com/yarn-and-npm-set-up-domestic-mirror-sources-zocffa.html

相关文章
  • 扫码加我微信
  • 验证消息请输入:来自你的博客
  • weinxin
  • 我的微信公众号
  • 微信扫一扫与我交流吧
  • weinxin
Terwer
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: