START
- 運行vue項目(npm run dev)報錯
- 報錯如下
DONE Compiled successfully in 11178ms 下午3:42:04 App running at: - Local: http://localhost:8080/ - Network: unavailable Note that the development build is not optimized. To create a production build, run npm run build. events.js:292 throw er; // Unhandled 'error' event ^ Error: spawn cmd ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19) at onErrorNT (internal/child_process.js:465:16) at processTicksAndRejections (internal/process/task_queues.js:80:21) Emitted 'error' event on ChildProcess instance at: at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) at onErrorNT (internal/child_process.js:465:16) at processTicksAndRejections (internal/process/task_queues.js:80:21) { errno: -4058, code: 'ENOENT', syscall: 'spawn cmd', path: 'cmd', spawnargs: [ '/c', 'start', '""', '/b', 'http://localhost:8080/' ] } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! app@0.1.0 serve: `vue-cli-service serve` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the app@0.1.0 serve 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:\node\node_cache\_logs\2020-12-19T07_42_04_693Z-debug.log
解決
- 原因: 電腦缺少cmd運行程序的環境變量
- 解決方法

環境變量配置圖解.png
END
- 可以總結一下啊
spawn xxx ENOENT
其實就是缺少,對應的運行程序的環境變量(系統環境變量中Path中添加C:\Windows\System32)。