NPM Binary 镜像配置
2024/10/21 6 mins read See this issue
# 陈年老博客
# npm package
Back
To Top
# Windows:在C:\Users\xxx.npmrc文件内添加所对应的二进制包镜像源
# macOS:复制以下配置至 .bashrc 或 .zshrc 中,使用npmmirror.com提供的二进制镜像
# === NPM BINARY CHINA ===
# https://github.com/cnpm/binary-mirror-config/blob/master/package.json#L53
export NODEJS_ORG_MIRROR="https://cdn.npmmirror.com/binaries/node"
export NVM_NODEJS_ORG_MIRROR="https://cdn.npmmirror.com/binaries/node"
export PHANTOMJS_CDNURL="https://cdn.npmmirror.com/binaries/phantomjs"
export CHROMEDRIVER_CDNURL="https://cdn.npmmirror.com/binaries/chromedriver"
export OPERADRIVER_CDNURL="https://cdn.npmmirror.com/binaries/operadriver"
export ELECTRON_MIRROR="https://cdn.npmmirror.com/binaries/electron/"
export ELECTRON_BUILDER_BINARIES_MIRROR="https://cdn.npmmirror.com/binaries/electron-builder-binaries/"
export SASS_BINARY_SITE="https://cdn.npmmirror.com/binaries/node-sass"
export SWC_BINARY_SITE="https://cdn.npmmirror.com/binaries/node-swc"
export NWJS_URLBASE="https://cdn.npmmirror.com/binaries/nwjs/v"
export PUPPETEER_DOWNLOAD_HOST="https://cdn.npmmirror.com/binaries"
export SENTRYCLI_CDNURL="https://cdn.npmmirror.com/binaries/sentry-cli"
export SAUCECTL_INSTALL_BINARY_MIRROR="https://cdn.npmmirror.com/binaries/saucectl"
export npm_config_sharp_binary_host="https://cdn.npmmirror.com/binaries/sharp"
export npm_config_sharp_libvips_binary_host="https://cdn.npmmirror.com/binaries/sharp-libvips"
export npm_config_robotjs_binary_host="https://cdn.npmmirror.com/binaries/robotj"
# For Cypress >=10.6.0, https://docs.cypress.io/guides/references/changelog#10-6-0
export CYPRESS_DOWNLOAD_PATH_TEMPLATE='https://cdn.npmmirror.com/binaries/cypress/${version}/${platform}-${arch}/cypress.zip'
# 或手动添加所需:
<!-- npm 总镜像淘宝源配置 -->
npm config set registry https://registry.npmmirror.com/
<!-- 1、node-sass 二进制包镜像 sass_binary_site -->
npm config set sass_binary_site https://registry.npmmirror.com/-/binary/node-sass
<!-- 2、electron 二进制包镜像 electron_mirror -->
npm config set electron_mirror https://registry.npmmirror.com/-/binary/electron
<!-- 3、puppeteer 二进制包镜像 puppeteer_download_host -->
npm config set puppeteer_download_host https://registry.npmmirror.com/-/binary
<!-- 4、chromedriver 二进制包镜像 chromedriver_cdnurl -->
npm config set chromedriver_cdnurl https://registry.npmmirror.com/-/binary/chromedriver
<!-- 5、operadriver 二进制包镜像 operadriver_cdnurl -->
npm config set operadriver_cdnurl https://registry.npmmirror.com/-/binary/operadriver
<!-- 6、phantomjs 二进制包镜像 phantomjs_cdnurl -->
npm config set phantomjs_cdnurl https://registry.npmmirror.com/-/binary/phantomjs
<!-- 7、selenium 二进制包镜像 selenium_cdnurl -->
npm config set selenium_cdnurl https://registry.npmmirror.com/-/binary/selenium
<!-- 8、node-inspector 二进制包镜像 node_inspector_cdnurl -->
npm config set node_inspector_cdnurl https://registry.npmmirror.com/-/binary/node-inspector
<!-- 9、sentry-cli 二进制包镜像 sentrycli_cdnurl -->
npm config set sentrycli_cdnurl https://registry.npmmirror.com/-/binary/sentry-cli
<!-- 10、sqlite3 二进制包镜像 sqlite3_binary_site -->
npm config set sqlite3_binary_site https://registry.npmmirror.com/-/binary/sqlite3
<!-- 11、python 二进制包镜像 python_mirror -->
npm config set python_mirror https://registry.npmmirror.com/-/binary/python