npm install一直報錯:npm ERR! Unexpected end of JSON input while parsing near
3 min readJun 10, 2019
最近玩一個前端套版,而這套版本身有支援到Angular 7,在套件沒污染前及本身是全新的狀態,直接進行指令npm install,馬上出現以下的錯誤,處理過程中,我嘗試過讓它升級到Angular 8,順手也把所有套件都升級了,但是結果當然還是無法逃過ERR!這一劫…所以…
npm WARN deprecated jquery-jcrop@0.9.13: No further updates to this package after v0.9.15. Please use original creator’s npm package https://www.npmjs.com/package/jcrop for current/future versions 3.0+.
npm WARN deprecated to-markdown@3.1.1: to-markdown has been renamed to Turndown, with a new API. Please update to turndown v4.0.0 or above and see the migration guide for details: https://github.com/domchristie/turndown/wiki/Migrating-from-to-markdown-to-Turndown
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! Unexpected end of JSON input while parsing near ‘…”:”0.5.x”,”clone”:”0.’npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\qfinm\AppData\Roaming\npm-cache\_logs\2019–06–10T10_53_14_760Z-debug.log
如果出現以上的問題,建議可以試試以下指令(清空暫存):
npm cache clean --force
最後再npm install試試看,到這邊我是可以讓程式安裝完畢!但是…
然後ng serve時,又出現未安裝sass的錯誤
上圖根據它給的錯誤訊息是Can not find module ‘node-sass’,所以再執行以下安裝指令:
npm install --save-dev node-sass
最後,再執行ng serve把Angular程式執行起來後顯示網頁沒有問題了!