Validating variables using the node built-in debugger?

I am trying to use node debugger. I am running node debug server to start my server. Then I have:

 ... var Workspace = mongoose.model('Workspace'); debugger; 

At this point, as expected, a debugger pops up when you run this code. However, I expect it to set all the current variables, as it does in the Chrome native debugger.

But:

 break in hotplate/node_modules/bd/lib/bd.js:133 132 133 debugger; 134 135 // Delete the ID and the version since there no point, debug> Workspace ReferenceError: Workspace is not defined 

So ... how can I check the current variables?

Bonus question: is there any way to use Chrome Developer Tools (CTRL-J) so that it connects to node and works this way? (I know the node inspector, but it is very outdated and ...)

+46
debugging
Dec 18 '12 at 4:13
source share
2 answers

Use the repl command (see the third example in docs )

 break in hotplate/node_modules/bd/lib/bd.js:133 132 133 debugger; 134 135 // Delete the ID and the version since there no point, debug> repl Press Ctrl + C to leave debug repl > Workspace 

Update: bonus issue - https://github.com/c4milo/node-webkit-agent

+74
Dec 18 '12 at 5:22
source share

The answer to the question about the bonus changed in 2018.

Run node inspect foo.js

Visit chrome://inspect and in the list of devices you will see an entry labeled Target (<process.version>) with an accompanying verification link.

It looks like this: enter image description here

0
Dec 07 '18 at 2:57
source share



All Articles