Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to debug node repl

Is is it possible debug NODE REPL. node cmd bring the repl prompt >. within the prompt is it possible to start the debugger. say for eg

> hello = function(){
....debugger;
....console.log('hello');
}
>hello() --> should run in the debugger..
like image 503
coool Avatar asked Feb 03 '26 13:02

coool


1 Answers

Yes

New way: node 8 >=

node --debug is marked for deprecation.

[DEP0062] DeprecationWarning: node --debug and node --debug-brk are invalid. Please use node --inspect or node --inspect-brk instead.

node --inspect is the way moving forward.

Old way

Start the repl with node --debug. Then you can can use node-inspector (an npm package) from a separate terminal, and debug in your browser with the chrome developer tools by opening http://localhost:8080/debug?port=5858 in chrome. You can, for example, set a breakpoint in the repl.js file in the complete function, and if you go to the node repl and hit TAB, it will trigger the breakpoint and you can debug it.

If you want the coffee-script repl, it's coffee --nodejs --debug.

like image 165
Peter Lyons Avatar answered Feb 05 '26 03:02

Peter Lyons



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!