常用的npm的packages mirror配置

  • chrome driver

    https://www.npmjs.com/package/chromedriver

    1
    2
    3
    4
    5
    # 安装指定地址
    npm install chromedriver --chromedriver_cdnurl=https://npm.taobao.org/mirrors/chromedriver

    # 直接设置`.npmrc`变量
    npm config set chromedriver_cdnurl "https://npm.taobao.org/mirrors/chromedriver"
    1
    2
    # 添加环境变量 CHROMEDRIVER_CDNURL
    CHROMEDRIVER_CDNURL=https://npm.taobao.org/mirrors/chromedriver npm install chromedriver
  • electron

    https://npm.taobao.org/mirrors/electron/

    1
    2
    3
    4
    npm config set electron_mirror https://npm.taobao.org/mirrors/electron/

    # 或者
    ELECTRON_MIRROR="https://npm.taobao.org/mirrors/electron/" npm i electron
  • phantomjs

    https://github.com/Medium/phantomjs

    1
    2
    3
    4
    5
    6
    7
    npm install phantomjs-prebuilt --phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/

    # .npmrc 方式
    npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/

    # PATH
    PHANTOMJS_CDNURL=https://npm.taobao.org/mirrors/phantomjs/
  • node-sass

    https://github.com/sass/node-sass

    1
    2
    3
    npm install -g mirror-config-china --registry=http://registry.npm.taobao.org
    # .npmrc
    npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/