PS E:\vue3-vite\my-app> npm run dev

> my-app@0.0.0 dev
> vite

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

Error: spawn E:\vue3-vite\my-app\node_modules\esbuild\esbuild.exe ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn E:\\vue3-vite\\my-app\\node_modules\\esbuild\\esbuild.exe',
  path: 'E:\\vue3-vite\\my-app\\node_modules\\esbuild\\esbuild.exe',
  spawnargs: [ '--service=0.12.22', '--ping' ]
}
npm ERR! code 1
npm ERR! path E:\vue3-vite\my-app
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c vite

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\node\node_cache\_logs\2021-08-26T02_24_14_376Z-debug.log

解决方式:node node_modules/esbuild/install.js

PS E:\vue3-vite\my-app> node node_modules/esbuild/install.js
PS E:\vue3-vite\my-app> npm run dev

> my-app@0.0.0 dev
> vite

Pre-bundling dependencies:
  vue
(this will be run only when your dependencies or config have changed)

  vite v2.5.1 dev server running at:

  > Local: http://localhost:3000/
  > Network: use `--host` to expose

  ready in 1645ms.

 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐