更换淘宝源

第一种方式:打开terminal执行以下命令

- npm config set registry=https://registry.npm.taobao.org
- npm config set sass_binary_site =http://cdn.npm.taobao.org/dist/node-sass
- npm config set phantomjs_cdnurl =https://npm.taobao.org/mirrors/phantomjs
- npm config set electron_mirror =https://npm.taobao.org/mirrors/electron
- npm config set chromedriver_cdnurl=http://npm.taobao.org/mirrors/chromedriver
- npm config set operadriver_cdnurl=http://npm.taobao.org/mirrors/operadriver
- npm config set selenium_cdnurl=http://npm.taobao.org/mirrors/selenium
- npm config set node_inspector_cdnurl=https://npm.taobao.org/mirrors/node-inspector

第二种方式:

进入到用户目录下
- vim .npm 显示.npm/ .npmrc
- vim .npmrc 粘贴以下内容
geckodriver_cdnurl= "https://npm.taobao.org/mirrors/geckodriver/"
sass_binary_site="http://cdn.npm.taobao.org/dist/node-sass"
phantomjs_cdnurl="https://npm.taobao.org/mirrors/phantomjs"
electron_mirror="https://npm.taobao.org/mirrors/electron"
registry=https://registry.npm.taobao.org/
chromedriver_cdnurl=http://npm.taobao.org/mirrors/chromedriver
operadriver_cdnurl=http://npm.taobao.org/mirrors/operadriver
selenium_cdnurl=http://npm.taobao.org/mirrors/selenium
node_inspector_cdnurl=https://npm.taobao.org/mirrors/node-inspector
如果使用的是yarn

- vim .yarnrc 粘贴以下内容即可
registry "https://registry.npm.taobao.org"
sass_binary_site "http://cdn.npm.taobao.org/dist/node-sass"
phantomjs_cdnurl "https://npm.taobao.org/mirrors/phantomjs"
electron_mirror "https://npm.taobao.org/mirrors/electron"
chromedriver_cdnurl "http://npm.taobao.org/mirrors/chromedriver"
operadriver_cdnurl "http://npm.taobao.org/mirrors/operadriver"
selenium_cdnurl "http://npm.taobao.org/mirrors/selenium"
node_inspector_cdnurl "https://npm.taobao.org/mirrors/node-inspector"
geckodriver_cdnurl "https://npm.taobao.org/mirrors/geckodriver/"

posted @ 2018-02-22 15:55  一叶一菩提22  阅读(610)  评论(0编辑  收藏  举报