"npm run dev" failed because of esbuild.
See original GitHub issue⚠️ IMPORTANT ⚠️ Please do not ignore this template. If you do, your issue will be closed immediately.
- Read the docs.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- This is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
Describe the bug
After init a vite project, run “npm run dev” failed.
Reproduction
npm init @vitejs/app
Project name: · vite-project
Select a template: · vue-ts
System Info
vite
version: 2.0.5- Operating System: win10 20H2 19042.844
- Node version: v14.16.0
- Package manager (npm/yarn/pnpm) and version: npm 7.6.0
Logs (Optional if provided reproduction)
PS H:\tutorial> npm init @vitejs/app √ Project name: · vite-project
Scaffolding project in H:\tutorial\vite-project… √ Select a template: · vue-ts
Done. Now run:
cd vite-project npm install npm run dev
PS H:\tutorial> cd .\vite-project
PS H:\tutorial\vite-project> npm install
added 60 packages in 3s PS H:\tutorial\vite-project> npm run dev
vite-project@0.0.0 dev vite
events.js:292 throw er; // Unhandled ‘error’ event ^
Error: spawn H:\tutorial\vite-project\node_modules\esbuild\esbuild.exe 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 H:\tutorial\vite-project\node_modules\esbuild\esbuild.exe’, path: ‘H:\tutorial\vite-project\node_modules\esbuild\esbuild.exe’, spawnargs: [ ‘–service=0.8.57’, ‘–ping’ ] }
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top GitHub Comments
Hey @sandy-74, it’s probably because of some NPM / other registry config problem. I faced the same issue because I had my NPM
ignore-scripts
config set totrue
. If this is the case for you, you can change it by doing:npm config set ignore-scripts false
. There probably are ways to do this manually, but this is the quickest (but unsafe) way to fix it.Thanks! Running
npm config set ignore-scripts false
and reinstalling all node modules fixed the issue for me