使用--ignore-scripts解決npm/yarn安裝依賴失敗問題


npm安裝報錯問題一:

最近使用npm安裝依賴頻繁遇到安裝失敗的問題,報錯如下

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fibers@4.0.3 install: `node build.js || nodejs build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fibers@4.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\Program Files\JavaScript\nodejs-14.17.6\node_cache\_logs\2021-09-29T04_09_38_618Z-debug.log

 

解決方案

 npm install fibers@4.0.3 --ignore-scripts

清除公司私服的temp目錄
一般人都不會這么干

 

原因探究
公司私服代理阻止了依賴的正常安裝,或者是你本地的腳本文件異常導致了依賴安裝失敗(上方報錯信息中的./scripts/checkYarn.js)

 

 

 

 

 

 

 

 

npm安裝報錯問題二:

Error:npm ERR! Failed at the bcrypt@5.0.0 install script.

npm ERR! code ELIFECYCLE npm ERR! errno 9009 npm ERR! bcrypt@5.0.0 install: `node-pre-gyp install --fallback-to-build` npm ERR! Exit status 9009 npm ERR! npm ERR! Failed at the bcrypt@5.0.0 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Solution1

Reason for Error : Node maybe can’t able to find the Python path on your system

step: 1 Rum command prompt as administrator step 2 Install the package

 npm install --global --production windows-build-tools

It may take some while, keep patient

step 3 Now install

npm install node-gyp

Last step Now you are ready to Go

npm install bcrypt

 

 

 

 

 

 

 

 

 

  • 安裝命令使用下面的命令 XXX換成在里面報錯無法正常安裝的插件名稱
npm i XXXX --ignore-scripts
// or
yarn XXXX --ignore-scripts

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM