npm install -g @angular/cli@latest 失敗


一開始的ERROR信息是

error “@angular/compiler-cli” package was not properly installed

嘗試方案二時又出現了以下的ERROR信息

npm ERR! code EINTEGRITY
npm ERR! sha1-OmJbxBx6n5nVnWRVKFfdGvDt2dQ= integrity checksum failed when using sha1: wanted sha1-OmJbxBx6n5nVnWRVKFfdGvDt2dQ= but got sha1-PVZuUT5szAqjMvKCcIwuIcpR9KY=. (259028 bytes)

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\sp\AppData\Roaming\npm-cache_logs\2017-09-20T04_31_14_778Z-debug.log

嘗試了多種方案

方案一(失敗)

清除緩存

npm cache verify

方案二(失敗)

1.Uninstall and clean (global)

rm -rf node_modules dist
npm uninstall -g @angular/cli
npm cache verify

2.Reinstall and play (global)

npm install -g @angular/cli@latest
npm install
ng serve

最終的解決辦法是

grep -ir "sha1-OmJbxBx6n5nVnWRVKFfdGvDt2dQ= integrity checksum" (npm的安裝目錄)

再次運行 npm install

然后全局更新TypeScript和angular cli ,再目錄更新TypeScript和angular cli
ng server 完成


免責聲明!

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



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