question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: spawn C:\..\node_modules\esbuild\esbuild.exe ENOENT

See original GitHub issue

Describe the bug

npm run build error

System Info

  • vite version: 2.0.0-beta.5
  • Operating System: Windows 10
  • Node version: v15.5.1
  • Optional:
    • npm version: 7.0.9

Logs (Optional if provided reproduction)

$ npm run build --debug

> admin@0.0.0 build
> vite build && mv ../public/_admin/index.html ../resources/views/admin.blade.php

building for production...
node:events:353
      throw er; // Unhandled 'error' event
      ^

Error: spawn C:\Users\Administrator\code\lykee\admin\node_modules\esbuild\esbuild.exe ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:276:19)
    at onErrorNT (node:internal/child_process:476:16)
    at processTicksAndRejections (node:internal/process/task_queues:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:12)
    at onErrorNT (node:internal/child_process:476:16)
    at processTicksAndRejections (node:internal/process/task_queues:80:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\Administrator\\code\\lykee\\admin\\node_modules\\esbuild\\esbuild.exe',
  path: 'C:\\Users\\Administrator\\code\\lykee\\admin\\node_modules\\esbuild\\esbuild.exe',
  spawnargs: [ '--service=0.8.29' ]
}
npm ERR! code 1
npm ERR! path C:\Users\Administrator\code\lykee\admin
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c "vite build && mv ../public/_admin/index.html ../resources/views/admin.blade.php"

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Local\npm-cache\_logs\2021-01-05T06_28_01_397Z-debug.log

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (2 by maintainers)

github_iconTop GitHub Comments

114reactions
allowingcommented, Jan 5, 2021

I know how to fix it. Run: node ./node_modules/esbuild/install.js. This should be written in package.json, but the custom package.json does not have this sentence, so you can run it manually.

9reactions
evanwcommented, Feb 5, 2021

It turns out npm v7 has a bug that corrupts package-lock.json files: https://github.com/npm/cli/issues/2606. When this happens, packages like esbuild with post install scripts can break. You may be experiencing this bug. A workaround is to delete and recreate your package-lock.json file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: spawn C:\Program ENOENT (Cannot build ... - GitHub
Nope, I am using the cmd.exe. Also I am tried these consoles: Cmd, Powershell, Windows Terminal.
Read more >
How do I debug "Error: spawn ENOENT" on node.js?
Tried all nothing worked , my system has different issue . The working solution for me is run command : npm config set...
Read more >
Build error MSBuild.exe ENOENT with new node version
Here is the error from build. gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin\ ...
Read more >
ended with error spawn cmd.exe ENOENT - YouTube
ended with error spawn cmd. exe ENOENT (salesforce) ... to Install and Set Visual Studio Code and MinGW Compiler for C and C++...
Read more >
Error: spawn openocd.exe ENOENT" I was wondering ... - Reddit
I got an error in Vscode when I want to debug "Failed to launch OpenOCD GDB Server: Error: spawn openocd.exe ENOENT" I was...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found