npm install 報錯情況如下
情況一
報錯**:errno:-4048;**
The operation was rejected by your operation system的解決方法
原因:操作系統不允許
解決方法:
方法一
用管理員權限打開node,再執行命令npm install
方法二
先清空緩存 npm cache clean --force
再安裝 npm install ?no-bin-links
no-bin-links 解釋
The --no-bin-links argument will prevent npm from creating symlinks for any binaries the package might contain.
字面意思是設置 npm install 時不要創建符號鏈接。
查了下說是爲了解決 linux 下,npm 在 ntfs 分區上運行 npm install 遇到的創建軟連接失敗問題引入的。
情況二
如果安裝過程中超時,或者某些依賴無法安裝的話,可以用cnpm試下
方法如下
先安裝cnpm npm install -g cnpm --registry=https://registry.npm.taobao.org
使用cnpm安裝 cnpm install