ionic瀏覽器刷新頁面報錯throw er; // Unhandled 'error' event解決方法

這幾天做移動端開發,需要使用Ionic寫手機客戶端,遇到一些奇怪的問題,具體問題就是啓動使用ionic serve啓動服務器之後只要一刷新界面就會導致服務器關閉,報的錯誤如下:

events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: spawn "C:\Program Files\nodejs\node.exe" ENOENT
    at notFoundError (C:\Users\李元壩\AppData\Roaming\npm\node_modules\ionic\node_modules\cross-spawn\lib\enoent.js:11:11)
    at verifyENOENT (C:\Users\李元壩\AppData\Roaming\npm\node_modules\ionic\node_modules\cross-spawn\lib\enoent.js:46:16)
    at ChildProcess.cp.emit (C:\Users\李元壩\AppData\Roaming\npm\node_modules\ionic\node_modules\cross-spawn\lib\enoent.js:33:19)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)


解決方法:進入如下目錄:

C:\Users\李元壩\AppData\Roaming\npm\node_modules\ionic\node_modules\cross-spawn\lib\enoent.js,使用notepad++打開enoent.js,找到該行代碼var isWin = process.platform === 'win32';由於本機電腦是64位的,所以修改爲var isWin = process.platform === 'win64';這樣再啓動ionic serve就不會遇到以上問題。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章