第一種方式:打開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-inspectornode
第二種方式:
進入到用戶目錄下
- 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
若是使用的是yarnchrome
- 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/"npm