Skip to content

"nuxt dev --inspect" tries to create multiple processes trying to listen on the same port #1195

@konstantin-lukas

Description

@konstantin-lukas

When you run the dev server with the inspect flag, you will see the following in the console:

$ npm run debug

> debug
> nuxt dev --inspect

│                                                                                                                                                                                                                      10:52:55 PM
●  Nuxt 4.2.2 (with Nitro 2.13.1, Vite 7.3.1 and Vue 3.5.27)
                                                                                                                                                                                                                       10:52:55 PM
  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

  ➜ DevTools: press Shift + Alt + D in the browser (v3.1.1)                                                                                                                                                            10:52:55 PM

✔ Vite client built in 13ms                                                                                                                                                                                           10:52:55 PM
✔ Vite server built in 27ms                                                                                                                                                                                           10:52:55 PM
✔ Nuxt Nitro server built in 307ms                                                                                                                                                                              nitro 10:52:55 PM
ℹ Vite server warmed up in 0ms                                                                                                                                                                                        10:52:55 PM
ℹ Vite client warmed up in 1ms                                                                                                                                                                                        10:52:55 PM
Debugger listening on ws://127.0.0.1:9229/71842a71-8c5c-49a3-aabd-7ddab5b96971
For help, see: https://nodejs.org/en/docs/inspector
Starting inspector on 127.0.0.1:9229 failed: address already in use

Notice that at the end it's trying to start an inspector on the same port as the debugger. I'm not sure if this is 100% related but it would make sense: I'm trying to debug my backend code. So far, I have been unable to do so. I try to attach the debugger from my IDE (WebStorm) to 9229, I get a frontend debugger that shows me the browser console. This is not very helpful. So I was thinking, perhaps the other process that failed to start might be another debugging process but for the h3 server. I also added the nuxt.run.yml described in the docs but that seems unrelated to this issue.

To reproduce:

  • Start a fresh Nuxt Project (I tried using the latest 4.2.2 but also 3.20.X)
  • Add a new script to the package.json named "debug" with the value "nuxt dev --inspect"
  • Run: npm run debug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions