Node -debug won't break or show code

I am trying to use node-debug to debug my CLI node script. According to everything I read, I just need to run my script with node-debug , which will run the script with --debug-brk and open my browser on the node-inspector .

It all works fine. I do not see the output from my script (which indicates that -debug-brk is running), my browser opens, it is connected to the node-inspector , and if I kill node-debug , the inspector will show that it is disabled.

But the inspector interface is empty. There is no code. No stack trace. Nothing.

There are not many options for node-debug , and none of them are like they will fix the problem I am facing.

 node-debug myscript.js 

Output

 debugger listening on port 5858 Node Inspector is now available from http://127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858 Debugging `myscript.js` 

Inspector Developer Console

 Assertion failed: Unknown experiment canvasInspection TypeError: Cannot read property 'createSetting' of undefined 
+5
source share
1 answer

This is the legacy of the debugger, which had a somewhat shaky foundation to start with, and since then it has not been synchronized with what Chrome uses to communicate, and has been abandoning it for some time.

Instead, you can use the new built-in inspector with the --inspect flag.

 node --inspect myscript.js 

There is a userland package, inspect-process , which makes this experience even more enjoyable and allows you to solve some potential problems that you may encounter.

Additional Resources

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

https://blog.risingstack.com/how-to-debug-nodej-js-with-the-best-tools-available/

+1
source

Source: https://habr.com/ru/post/1244083/


All Articles