史上最全的NodeJS國內鏡像設置,卡頓下包失敗的殺手鐗來了

史上最全的NodeJS國內鏡像設置,卡頓下包失敗的殺手鐗來了

Npm 國內鏡像設置

官方自帶npm的國內鏡像設置:

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/

Yarn 安裝及國內鏡像設置

覺得npm過於老舊不用npm了?那看這個:

npm install -g yarn
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

Cnpm 安裝 (原生國內鏡像)

有沒有更好的方法呢?cnpm也許是選擇之一。

npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install node-sass
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章