现在是
加载中...
加载中...

yarn和npm设置国内镜像源

2022-08-16 feat:更新最新镜像地址。

由于npm包部分依赖下载速度缓慢,最好使用国内镜像源来解决,一般使用淘宝开源的镜像1。

安装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

作者:Terwer

首发:浅海拾贝

原创内容,转载请注明出处!

评论