vite 启动项目报错

vite2下载后npm 启动报错

背景:

npm = 7.14.0

node.js = 16.0.0

 

报错信息如下:

up to date in 1s
PS D:\webdemo\vite\vite-project> npm run dev

> dev
> vite

node:events:342
throw er; // Unhandled ‘error‘ event
^
Error: spawn D:\webdemo\vite\vite-project\node_modules\esbuild\esbuild.exe ENOENT
at onErrorNT (node:internal/child_process:480:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
at onErrorNT (node:internal/child_process:480:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4058,
code: ‘ENOENT‘,
syscall: ‘spawn D:\\webdemo\\vite\\vite-project\\node_modules\\esbuild\\esbuild.exe‘,
path: ‘D:\\webdemo\\vite\\vite-project\\node_modules\\esbuild\\esbuild.exe‘,
spawnargs: [ ‘--service=0.12.12‘, ‘--ping‘ ]
}

 

查找原因:

通过github查阅vite仓库的相关issue【https://github.com/vitejs/vite/issues/1580】,尤大也很明确的指出这个是esbuild的BUG

解决方法:手动执行

node node_modules/esbuild/install.js

参考:vite安装vue项目报错(Error: esbuild: Failed to install correctly)_starsion-CSDN博客

vite 启动项目报错

上一篇:【Beta】Scrum meeting4


下一篇:收打款为什么要走财务审批流程