5

When I run node --inspect app.js it says "Debugger attached". Then I open up chrome://inspect and I see my app running there so I click either Open dedicated DevTools or Inspect (next to the app's name). No matter how I open Node DevTools though, it just doesn't seem to be connected to anything (I can't see the source code there, the debugger statements are ignored, nothing logs to the console etc). I also tried opening it by opening regular DevTools and clicking the green Node icon.

It's weird because Chrome clearly sees the server running and something is clearly connecting to Node (and I don't think there's anything else on my network that could do that) but I still can't get DevTools to even acknowledge the server's existence.

I also distinctly remember debugging something the same exact way a few weeks ago and back then everything worked fine (although I remember I also struggled with this a bit but I somehow got it to work at the end, I think attaching the name of the file at the end of the command instead of in putting it in the middle did the trick at the end). The only thing that's happened since then is that I updated from v8 to v10 (LTS)

I've obviously tried rebooting and also reading every manual and article about node --inspect out there, nothing helped.

4
  • Maybe this can help you @M. Farnik medium.com/the-node-js-collection/… Commented Mar 23, 2019 at 15:33
  • I've read that already and did exactly what it says, didn't help Commented Mar 23, 2019 at 15:50
  • @M.Farnik did you ever figure this out? I have the same issue - with the remote debugger / ssh tunneling, I see the remote target I need on the chrome://inspect page, but once I click the DevTools link I don't see any sources and I can't access the Javascript VM instance in the "Memory" tab. Commented Jan 19, 2022 at 19:23
  • Also experiencing this same issue.. Commented Feb 10, 2023 at 17:28

4 Answers 4

7

Chrome version: 92

For me, the problem was The Chrome DevTools was not looking for the connection port my Node.js process was using.

I did the following:

  1. Start the node process with --inspect flag. It started the process on port 9239.
  2. Type chrome://inspect/#devices in Chrome address bar.
  3. Click "Open dedicated DevTools for Node" in the devices page.
  4. It opens the "DevTools-Node.js" window.
  5. Click the "Connection" tab.
  6. Click "Add connection" button.
  7. Type localhost:9239 in the text box and click "Add".

After adding the correct port, the DevTools connected to the Node.js process and I was able to debug it.

Sign up to request clarification or add additional context in comments.

Comments

2

I was facing same problem, I have solved it by

1) Updated chrome to latest version and relaunched it

2) Restarted node --inspect server.js

3) Noted port number as shown here port number

4) Opened chrome://inspect and added localhost: port number noted in step 3 update connection in chrome

Comments

2

use command instead of node --inspect:-

node --inspect-brk

Comments

0

Seems to be a new chrome issue: https://github.com/nodejs/node/issues/26887

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.