Dennis Spierenburg
Dennis Spierenburg

Reputation: 643

Chrome inspect not showing Node app, debugger

I'm working on a Node.js project and it was working perfectly (friday around 3pm). I opened the same project this morning and the debugger of chrome isn't working anymore with my node --inspect command.

node --inspect server.js

It tells me it created a websocket where I can connect to. I can connect manualy with this websocket by using the standard ws url by chrome:

chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/{{YOUR_KEY}}

But this means I can't connect when I'm reloading my app. It is also not showing on the chrome://inspect#devices page

Im running the latest version of node (10.15). I've tested this on canary and the chromium browser. Canary has the same problem but on chromium it seems to be working fine.

Did chrome release a new update? How can I solve this problem and open my debugger!?

Edit

I can open the node develop tools now but it doesn't respond with my code. It looks like it is trying to connect but then fails and tries to reconnect again. The dev tools is also creating a session with my express app every second or so. The chromium way is only working for a single app and the websocket doesn't reconnect, this means I have to open my app every time I make a change in my code.

Upvotes: 5

Views: 6994

Answers (3)

My node inspector said: Debugger listening on ws://localhost:9229/20257ba4-44f1-48d4-a5c4-3ada183cbe91

But dev-tools was unable to connect.

When I executed ping localhost it said that it got an answer from ::1:, thus I suspected that there is some confusion between ipv4 and ipv6.

Fixed it by going to chrome://inspect#devices, then clicking on Open dedicated DevTools for Node and adding 127.0.0.1:9229 as a new network endpoint.

I recently updated node to v22.3.0, probably that is why it stopped working.

Upvotes: 1

betoharres
betoharres

Reputation: 1833

on express, using the binary file along with the --inspect flag worked for me...

$ nodemon --exec node --inspect ./bin/www

Upvotes: 0

Anupam Chaplot
Anupam Chaplot

Reputation: 1316

Please check the port on which your node application is running.

--inspect Listen on default address and port (127.0.0.1:9229)

Use, --inspect=[host:port] if you want to use any other port

https://nodejs.org/en/docs/guides/debugging-getting-started/

Upvotes: 1

Related Questions