Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
allowing opened this issue Jan 5, 2021 · 17 comments
Closed

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

allowing opened this issue Jan 5, 2021 · 17 comments

Comments

@allowing
Copy link

allowing commented Jan 5, 2021

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
@allowing
Copy link
Author

allowing commented 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.

@yyx990803
Copy link
Member

yyx990803 commented Jan 5, 2021

Check npm config get ignore-scripts. Your npm config seems to ignore esbuild's postinstall hook.

If that's not the problem, try installing esbuild directly in a fresh project - if that doesn't work also, then it's a esbuild bug and should be reported to esbuild instead.

@rainmanhhh
Copy link

Check npm config get ignore-scripts. Your npm config seems to ignore esbuild's postinstall hook.

If that's not the problem, try installing esbuild directly in a fresh project - if that doesn't work also, then it's a esbuild bug and should be reported to esbuild instead.

npm config get ignore-scripts returns false. manually run esbuild/install.js can fix the problem indeed. why it's ignored since the ignore-scripts is empty?

@evanw
Copy link

evanw commented Feb 5, 2021

It turns out npm v7 has a bug that corrupts package-lock.json files: npm/cli#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.

@blaunicorn
Copy link

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.

yes,this is right

@coolhome
Copy link

I had this exact error but for a different reason. I was on a machine with App Locker enable and it prevented the execution of esbuild.exe.

@David00154
Copy link

Just run npm install esbuild that's all

@chhiqq
Copy link

chhiqq commented Jun 11, 2021

Check npm config get ignore-scripts. Your npm config seems to ignore esbuild's postinstall hook.

If that's not the problem, try installing esbuild directly in a fresh project - if that doesn't work also, then it's a esbuild bug and should be reported to esbuild instead.

这个bug居然还在 不应该呀尤大

@Abiel1024
Copy link

It turns out npm v7 has a bug that corrupts package-lock.json files: npm/cli#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.

it works for me!

@angelsbv
Copy link

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.

EL HOMBRE!

@SnowWarri0r
Copy link

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.

it worked!

@lihanspace
Copy link

这个是vite的bug还是npm的bug

@lihanspace
Copy link

lihanspace commented Aug 5, 2021

package-lock.json"node_modules/esbuild" 缺少 "hasInstallScript": true , 所以esbuild的install.js没有运行生成esbuild.exe
这个是npm生成packag-lock.json时出错了吗?还是说需要自己进行配置

@sakura-he
Copy link

node ./node_modules/esbuild/install.js

@JACK-ZHANG-coming
Copy link

package-lock.json"node_modules/esbuild" 缺少 "hasInstallScript": true , 所以esbuild的install.js没有运行生成esbuild.exe
这个是npm生成packag-lock.json时出错了吗?还是说需要自己进行配置

node ./node_modules/esbuild/install.js 为啥我运行这一句也不行了呢??呃

@zhangenming
Copy link
Contributor

相同的问, 需要执行node ./node_modules/esbuild/install.js

所以这不是BUG吗 不修一下吗

@KenetGaona115
Copy link

Just run npm install esbuild that's all

it works for me

@github-actions github-actions bot locked and limited conversation to collaborators Sep 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests