Skip to content

Instantly share code, notes, and snippets.

@52cik
Last active October 7, 2024 06:03
Show Gist options
  • Save 52cik/c1de8926e20971f415dd to your computer and use it in GitHub Desktop.
Save 52cik/c1de8926e20971f415dd to your computer and use it in GitHub Desktop.
npm 淘宝镜像配置
npm set registry https://r.npm.taobao.org # 注册模块镜像
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass # node-sass 二进制包镜像
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ # electron 二进制包镜像
npm set ELECTRON_MIRROR https://cdn.npm.taobao.org/dist/electron/ # electron 二进制包镜像
npm set puppeteer_download_host https://npm.taobao.org/mirrors # puppeteer 二进制包镜像
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver # chromedriver 二进制包镜像
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver # operadriver 二进制包镜像
npm set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs # phantomjs 二进制包镜像
npm set selenium_cdnurl https://npm.taobao.org/mirrors/selenium # selenium 二进制包镜像
npm set node_inspector_cdnurl https://npm.taobao.org/mirrors/node-inspector # node-inspector 二进制包镜像
npm cache clean --force # 清空缓存
@ValorLin
Copy link

补充两个二进制包

npm set selenium_cdnurl=http://npm.taobao.org/mirrors/selenium
npm set node_inspector_cdnurl=https://npm.taobao.org/mirrors/node-inspector

@liril-net
Copy link

使用 npm cache verify 会不会更好一点?

@haoxi911
Copy link

npm cache verify 没用的

@fengmk2
Copy link

fengmk2 commented May 24, 2019

使用 npm set registry https://r.npm.taobao.org 会更加快。

@lvxianchao
Copy link

lvxianchao commented Jul 16, 2019

使用 npm set registry https://r.npm.taobao.org 会更加快。

@fengmk2 什么道理?

@ivysrono
Copy link

npm config set ELECTRON_MIRROR https://cdn.npm.taobao.org/dist/electron/ # electron7+ 二进制包镜像

原来的设置在 Electron7 会碰到失败的问题,改成如上网址可以解决。

@wusongliang
Copy link

@nielinjie
Copy link

如果同时需要发布 npm package需要怎么设置registry?我理解taobao的镜像是只读的。官方源与taobao源切换?

@alexjohndoe
Copy link

使用 npm set registry https://r.npm.taobao.org 会更加快。

ping 了一下,发现两者是同一个 IP 哦

@alexjohndoe
Copy link

我看淘宝 npm 镜像官网和示例地址修改为了 registry.npmmirror.com,是否需要同步修改呢?官网:https://npmmirror.com/

@liuliangsir
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment