一、启动vue项目,如下报错:
App running at:
-Local: http://localhost:80/
-Network:unavailable
Note that the development build is not optimized.
To create a production build, run npm run build.
node:events:505
throw er; // Unhandled'error'event
Error:spawn cmd ENOENT
at Process ChildProcess._handle.onexit (node:interna1/chi1d_process:283:19)
at onErrorNT (node:interna1/chi1d_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on Chi1dProcess instance at:
at Process.Chi1dProcess_handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:interna1/chi1d_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21){
errno: -4058,
code: 'ENOENT',
syscall: 'spawn cmd',
path:'cmd',
spawnargs:['/c','start','""','/b','http://localhost:80/']
}
百度搜索 throw er; // Unhandled'error'event 都说是因为端口被占用了,但是用命令行kill占用的端口后还是报错
二、报错原因:
电脑缺少cmd运行程序的环境变量
三、解决方案:
环境变量Path中添加
C:WindowsSystem32
或者%SystemRoot%system32
具体步骤:
win10版本操作步骤 (不要加分号)
win7版本操作步骤 (要加分号)
设置后重新运行项目即可,若是还没有效果可尝试重启电脑