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

Unable to run a generated project, "Error: spawn EBADF" #548

Closed
botic opened this issue Oct 31, 2024 · 9 comments
Closed

Unable to run a generated project, "Error: spawn EBADF" #548

botic opened this issue Oct 31, 2024 · 9 comments

Comments

@botic
Copy link

botic commented Oct 31, 2024

I followed the basic guide on the Nuxt website:

npx nuxi init landingpage

After changing into the generated directory, running npm run dev fails with:

landingpage > npm run dev

> dev
> nuxt dev

Nuxt 3.13.2 with Nitro 2.9.7                                                                                                                                              18:45:58
                                                                                                                                                                          18:45:58
  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

  ➜ DevTools: press Shift + Option + D in the browser (v1.6.0)                                                                                                            18:46:00


 WARN  Failed to parse static properties from plugin node_modules/nuxt/dist/app/plugins/navigation-repaint.client.js. spawn EBADF                                         18:46:01

  at ChildProcess.spawn (node:internal/child_process:421:11)
  at Object.spawn (node:child_process:762:9)
  at ensureServiceIsRunning (node_modules/esbuild/lib/main.js:1980:29)
  at transform (node_modules/esbuild/lib/main.js:1880:37)
  at extractMetadata (node_modules/nuxt/dist/index.mjs:3838:20)
  at annotatePlugins (node_modules/nuxt/dist/index.mjs:5421:18)
  at async getContents (node_modules/nuxt/dist/index.mjs:4775:27)
  at async i.getContents (node_modules/@nuxt/devtools/dist/chunks/plugin-metrics.mjs:10:23)
  at async processTemplate (node_modules/nuxt/dist/index.mjs:5271:22)
  at async Promise.allSettled (index 0)

…
…
…

 ERROR  error while updating dependencies:                                                                                                                                18:47:09
Error: spawn EBADF
    at ChildProcess.spawn (node:internal/child_process:421:11)
    at Object.spawn (node:child_process:762:9)
    at ensureServiceIsRunning (/Users/philipp/Code/xxxx/landingpage/node_modules/vite/node_modules/esbuild/lib/main.js:1975:29)
    at Object.context (/Users/philipp/Code/xxxx/landingpage/node_modules/vite/node_modules/esbuild/lib/main.js:1874:33)
    at prepareEsbuildOptimizerRun (file:///Users/philipp/Code/xxxx/landingpage/node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:50924:33)

The dev webserver just returns:

500
[vite-node] [plugin:vite:define] [EBADF] /@fs./node_modules/nuxt/dist/app/entry.js 

My environment: Node v20.18.0 and macOS Version 15.0.1 (24A348)

I have no idea what goes wrong. Maybe something at the CLI after it created the directory and initialized the files?

Image

@danielaag
Copy link

I have a very similar issue today from trying to run a fresh install usingnuxi init (nuxi v3.15.0)

The error I get is ERROR [unhandledRejection] EMFILE: too many open files

Node Version 22.10.0
Mac OS Version 14.5 (23F79)

Image

@kamding957
Copy link

I also made the same mistake, How to solve this problem?

@ducmanhdev
Copy link

The current temporary solution I found is to disable devtools, until this bug is fixed.

@usmonov-r
Copy link

Thanks @ducmanhdev , Toggling devtools off and then back on worked perfectly for me as a temporary fix.

@harcop
Copy link

harcop commented Nov 1, 2024

The current temporary solution I found is to disable devtools, until this bug is fixed.

You saved my day, I have been on it all night.

@botic
Copy link
Author

botic commented Nov 1, 2024

I ran into the issue with Node 18/20/22. If you need further details, just ask me what you need and I'll provide them.

Switching off dev tools in the nuxt.config.ts didn't helped for me. Am I missing something? 🤔

@im-zoheb1
Copy link

im-zoheb1 commented Nov 1, 2024

@ducmanhdev Disabling Devtools worked for me, Thank you :)

@pi0
Copy link
Member

pi0 commented Nov 1, 2024

Crossref nuxt/nuxt#29744 (comment)

I have released a hotfix for unstorage that downgrades chokidar until investigating root cause better. (thanks for @danielroe to investigate)

Please recreate your lockfile and see if it solves issue (for me locally on MacOS it solved)

@botic
Copy link
Author

botic commented Nov 2, 2024

Works for me now after running again npx nuxi@latest init -t content landingpage 👍

landingpage > npm run dev

> dev
> nuxt dev

Nuxt 3.13.2 with Nitro 2.10.0                                                                                                                                               10:07:04
                                                                                                                                                                            10:07:04
  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

  ➜ DevTools: press Shift + Option + D in the browser (v1.6.0)                                                                                                              10:07:05

✔ Vite client built in 21ms                                                                                                                                                10:07:06
✔ Vite server built in 237ms                                                                                                                                               10:07:06
✔ Nuxt Nitro server built in 584 ms                                                                                                                                  nitro 10:07:06
[10:07:06] ℹ Nuxt now supports pinning the behavior of provider and deployment presets with a compatibility date. We recommend you specify a compatibilityDate in your nuxt.config file, or set an environment variable, such as COMPATIBILITY_DATE=2024-11-02.
ℹ Vite client warmed up in 0ms                                                                                                                                             10:07:06

❯ Do you want to update your nuxt.config to set compatibilityDate: '2024-11-02'?
✔ Do you want to update your nuxt.config to set compatibilityDate: '2024-11-02'?
Yes
✔ Compatibility date set to 2024-11-02 in nuxt.config.ts                                                                                                                   10:07:08
ℹ nuxt.config.ts updated. Restarting Nuxt...                                                                                                                               10:07:09
  ➜ DevTools: press Shift + Option + D in the browser (v1.6.0)                                                                                                              10:07:09

✔ Vite client built in 5ms                                                                                                                                                 10:07:09
✔ Vite server built in 136ms                                                                                                                                               10:07:09
✔ Nuxt Nitro server built in 374 ms                                                                                                                                  nitro 10:07:09
ℹ Vite client warmed up in 0ms                                                                                                                                             10:07:09
ℹ Vite server warmed up in 269ms

I think that can be closed with the chokidar hotfix in unjs/unstorage#502

@botic botic closed this as completed Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants