cli icon indicating copy to clipboard operation
cli copied to clipboard

Dev server crashes after V4 migration with deno as build preset

Open dyeske61283 opened this issue 5 months ago • 6 comments

Environment

  • Operating System: Darwin
  • Node Version: v23.6.0
  • Nuxt Version: 4.0.0
  • CLI Version: 3.26.2
  • Nitro Version: 2.12.0
  • Package Manager: deno@deno 2.4.1 (stable, release, aarch64-apple-darwin) v8 13.7.152.6-rusty typescript 5.8.3
  • Builder: -
  • User Config: compatibilityDate, future, experimental, devtools, plugins, modules, css, vite, nitro
  • Runtime Modules: @formkit/auto-animate/[email protected], @vueuse/[email protected], @pinia/[email protected]
  • Build Modules: -

Reproduction

You can checkout the latest 2 commits on the main branch of my repo: https://github.com/dyeske61283/gameday-helperplan The latest one includes the nuxt upgrade, as well as the crashing behavior, while the one before that does not crash.

Describe the bug

After the upgrade to nuxt v4 the dev server crashes with the following error: ERROR [unhandledRejection] connect ENOENT /var/folders/48/j9hzlp816436f_pfjtp64vtr0000gn/T/nuxt-dev-1752698296494-m8h174.sock 10:38:27 PM

at __node_internal_captureLargerStackTrace (ext:deno_node/internal/errors.ts:91:3)
at __node_internal_exceptionWithHostPort (ext:deno_node/internal/errors.ts:215:10)
at PipeConnectWrap._afterConnect [as oncomplete] (node:net:177:16)
at Pipe.afterConnect (ext:deno_node/internal_binding/connection_wrap.ts:43:11)
at ext:deno_node/internal_binding/pipe_wrap.ts:130:14
at eventLoopTick (ext:core/01_core.js:178:7)

error: Uncaught TypeError: Unknown signal: 0 at toDenoSignal (ext:deno_node/internal/child_process.ts:390:11) at ChildProcess.kill (ext:deno_node/internal/child_process.ts:299:53) at kill (file:///Users/kevindyes/Projects/mima/node_modules/.deno/@[email protected]/node_modules/@nuxt/cli/dist/chunks/dev.mjs:243:17) at Process. (file:///Users/kevindyes/Projects/mima/node_modules/.deno/@[email protected]/node_modules/@nuxt/cli/dist/chunks/dev.mjs:320:7) at Object.onceWrapper (ext:deno_node/_events.mjs:561:12) at Process.emit (ext:deno_node/_events.mjs:448:22) at Process.emit (node:process:342:40) at Process.exit (node:process:61:13) at Process. (file:///Users/kevindyes/Projects/mima/node_modules/.deno/@[email protected]/node_modules/@nuxt/cli/dist/chunks/index.mjs:376:15) at Object.onceWrapper (ext:deno_node/_events.mjs:561:12)

Additional context

No response

Logs


dyeske61283 avatar Jul 16 '25 20:07 dyeske61283

Stackblitz link for the reproduction: Stackblitz

github-actions[bot] avatar Jul 16 '25 20:07 github-actions[bot]

Could this be a duplicate of https://github.com/nuxt/nuxt/issues/23832 ?

cernymatej avatar Jul 17 '25 23:07 cernymatej

@cernymatej I don't think so tbh. Because I just tried out a new blank nuxt project with deno using

deno -A npm:nuxi@latest init

and it worked for nuxt 3.17.* After upgrading it to nuxt v4 the above crash happended - as said even on a clean project

dyeske61283 avatar Jul 21 '25 17:07 dyeske61283

the process.exit(0) issue was fixed in the latest nuxt cli (included in 4.0.1) but you need to provide new permissions to deno to access your tmpdir, which would be via a flag

we should document this

(or you can disable sockets with NUXT_SOCKET=0)

danielroe avatar Jul 21 '25 18:07 danielroe

@danielroe The workaround with disabling sockets works, but somehow I cannot get deno to get access to my tmpdir - even with specifying --allow-all. I also tried something like this:

deno run dev -o --allow-env=TMPDIR --allow-read="$TMPDIR" --allow-write="$TMPDIR"

That might be an issue with deno, though?

dyeske61283 avatar Jul 21 '25 19:07 dyeske61283

~~Disabling sockets, running NUXT_SOCKET=0 deno task dev works for me. But I also can't find a way to get Deno to use the tmpdir.~~

Actually, no, it just still doesn't work. Oh, I guess I posted it in the wrong repo, but this is what's happening: https://github.com/nuxt/nuxt/issues/32735

My relevant dev server errors on attempted page load:

ERROR  [unhandledRejection] connect ECONNREFUSED nuxt-dev-1241.sock

    at __node_internal_captureLargerStackTrace (ext:deno_node/internal/errors.ts:91:3)
    at __node_internal_exceptionWithHostPort (ext:deno_node/internal/errors.ts:215:10)
    at PipeConnectWrap._afterConnect [as oncomplete] (node:net:177:16)
    at Pipe.afterConnect (ext:deno_node/internal_binding/connection_wrap.ts:43:11)
    at ext:deno_node/internal_binding/pipe_wrap.ts:130:14
    at eventLoopTick (ext:core/01_core.js:178:7)

ERROR  [uncaughtException] No such file or directory (os error 2) about ["/home/REDCATED/code/bit2/.nuxt/dev/index.mjs"]

    at new FsWatcher (ext:runtime/40_fs_events.js:24:17)
    at Object.watchFs (ext:runtime/40_fs_events.js:74:10)
    at ext:deno_node/_fs/_fs_watch.ts:57:21
    at callback (ext:deno_web/02_timers.js:58:7)
    at eventLoopTick (ext:core/01_core.js:213:13)


 ERROR  [uncaughtException] No such file or directory (os error 2) about ["/home/REDCATED/code/bit2/.nuxt/dev/index.mjs.map"]

    at new FsWatcher (ext:runtime/40_fs_events.js:24:17)
    at Object.watchFs (ext:runtime/40_fs_events.js:74:10)
    at ext:deno_node/_fs/_fs_watch.ts:57:21
    at callback (ext:deno_web/02_timers.js:58:7)
    at eventLoopTick (ext:core/01_core.js:213:13)

carsonbird avatar Jul 22 '25 20:07 carsonbird