鍍金池/ 問答/Linux  網(wǎng)絡(luò)安全/ 在windows環(huán)境下使用npm install安裝package.json的依

在windows環(huán)境下使用npm install安裝package.json的依賴時,出現(xiàn)如圖的錯誤,如何解決?

使用npm安裝package.json下的依賴時出現(xiàn)圖片中的報錯:
系統(tǒng):windows
node版本:@8.4.0
npm版本:@5.3.0
圖片描述

已經(jīng)嘗試過更新node.js和npm,除了使用cnpm有其他的可以使用npm的方法嗎?

回答
編輯回答
浪蕩不羈

well, 在張同學(xué)的提醒下,問題已經(jīng)解決,來自問自答一波。
使用yarn可以解決,使用taobao鏡像會快很多
···bash
npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
yarn config set registry https://registry.npm.taobao.org --global
yarn config set disturl https://npm.taobao.org/dist --global
yarn
···
使用yarn安裝依賴就好,順便提一句如果使用cnpm后面運(yùn)行可能會報找不到依賴包的錯誤,所以依賴過多時盡量不要用cnpm來安裝。

2018年5月23日 21:21