因受國內的環境影響,導致了很多速度起不來,所以需要安裝國內鏡像。
配置 NPM 的淘寶鏡像源加速
打開poweshell
或cmd
工具,輸入以下命令:
npm config set registry https://registry.npm.taobao.org
npm config set disturl https://npm.taobao.org/dist
npm config set electron_mirror https://npm.taobao.org/mirrors/electron/
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/
然后輸入命令
npm get registry
得到返回結果為 https://registry.npm.taobao.org/ 說明注冊成功。
windows 下 Yarn 安裝與使用
如果你還沒有安裝 Yarn,通過訪問https://classic.yarnpkg.com/latest.msi,下載安裝包。雙擊安裝后,輸入命令
yarn -v
返回版本號1.22.4
即表示成功。
Yarn 注冊淘寶鏡像源加速
打開poweshell
或cmd
工具,輸入以下命令:
yarn config set registry https://registry.npm.taobao.org -g
yarn config set disturl https://npm.taobao.org/dist -g
yarn config set electron_mirror https://npm.taobao.org/mirrors/electron/ -g
yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g
yarn config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/ -g
yarn config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver -g
yarn config set operadriver_cdnurl https://cdn.npm.taobao.org/dist/operadriver -g
yarn config set fse_binary_host_mirror https://npm.taobao.org/mirrors/fsevents -g
然后輸入命令,查看當前地址源:
yarn config get registry
得到返回結果為 https://registry.npm.taobao.org/ 說明注冊成功。
本文作為資源記錄,轉載自:https://mp.weixin.qq.com/s/3LQVKnEY4Fk7UTtMBN5YxA