@@ -11,10 +11,10 @@ will be displayed indicating successful launch of the debugger:
1111
1212``` txt
1313$ node debug myscript.js
14- < debugger listening on port 5858
15- connecting... ok
14+ < Debugger listening on 127.0.0.1: 5858
15+ connecting to 127.0.0.1:5858 ... ok
1616break in /home/indutny/Code/git/indutny/myscript.js:1
17- 1 x = 5;
17+ > 1 global. x = 5;
1818 2 setTimeout(() => {
1919 3 debugger;
2020debug>
@@ -28,37 +28,37 @@ enable a breakpoint at that position in the code:
2828
2929``` js
3030// myscript.js
31- x = 5 ;
31+ global . x = 5 ;
3232setTimeout (() => {
3333 debugger ;
3434 console .log (' world' );
3535}, 1000 );
3636console .log (' hello' );
3737```
3838
39- Once the debugger is run, a breakpoint will occur at line 4 :
39+ Once the debugger is run, a breakpoint will occur at line 3 :
4040
4141``` txt
4242$ node debug myscript.js
43- < debugger listening on port 5858
44- connecting... ok
43+ < Debugger listening on 127.0.0.1: 5858
44+ connecting to 127.0.0.1:5858 ... ok
4545break in /home/indutny/Code/git/indutny/myscript.js:1
46- 1 x = 5;
46+ > 1 global. x = 5;
4747 2 setTimeout(() => {
4848 3 debugger;
4949debug> cont
5050< hello
5151break in /home/indutny/Code/git/indutny/myscript.js:3
52- 1 x = 5;
52+ 1 global. x = 5;
5353 2 setTimeout(() => {
54- 3 debugger;
54+ > 3 debugger;
5555 4 console.log('world');
5656 5 }, 1000);
5757debug> next
5858break in /home/indutny/Code/git/indutny/myscript.js:4
5959 2 setTimeout(() => {
6060 3 debugger;
61- 4 console.log('world');
61+ > 4 console.log('world');
6262 5 }, 1000);
6363 6 console.log('hello');
6464debug> repl
@@ -68,11 +68,11 @@ Press Ctrl + C to leave debug repl
6868> 2+2
69694
7070debug> next
71- < world
7271break in /home/indutny/Code/git/indutny/myscript.js:5
72+ < world
7373 3 debugger;
7474 4 console.log('world');
75- 5 }, 1000);
75+ > 5 }, 1000);
7676 6 console.log('hello');
7777 7
7878debug> quit
@@ -121,24 +121,26 @@ is not loaded yet:
121121
122122``` txt
123123$ node debug test/fixtures/break-in-module/main.js
124- < debugger listening on port 5858
125- connecting to port 5858... ok
124+ < Debugger listening on 127.0.0.1: 5858
125+ connecting to 127.0.0.1: 5858 ... ok
126126break in test/fixtures/break-in-module/main.js:1
127- 1 var mod = require('./mod.js');
127+ > 1 const mod = require('./mod.js');
128128 2 mod.hello();
129129 3 mod.hello();
130- debug> setBreakpoint('mod.js', 23 )
130+ debug> setBreakpoint('mod.js', 2 )
131131Warning: script 'mod.js' was not loaded yet.
132- 1 var mod = require('./mod.js');
132+ > 1 const mod = require('./mod.js');
133133 2 mod.hello();
134134 3 mod.hello();
135+ 4 debugger;
136+ 5
137+ 6 });
135138debug> c
136- break in test/fixtures/break-in-module/mod.js:23
137- 21
138- 22 exports.hello = () => {
139- 23 return 'hello from module';
140- 24 };
141- 25
139+ break in test/fixtures/break-in-module/mod.js:2
140+ 1 exports.hello = function() {
141+ > 2 return 'hello from module';
142+ 3 };
143+ 4
142144debug>
143145```
144146
@@ -169,7 +171,8 @@ breakpoint)
169171
170172### TCP-based protocol
171173
172- > Stability: 0 - Deprecated: Use [ V8 Inspector Integration] [ ] instead. The debug protocol used by the ` --debug ` flag was removed from V8.
174+ > Stability: 0 - Deprecated: Use [ V8 Inspector Integration] [ ] instead.
175+ The debug protocol used by the ` --debug ` flag was removed from V8.
173176
174177An alternative way of enabling and accessing the debugger is to start
175178Node.js with the ` --debug ` command-line flag or by signaling an existing
@@ -188,8 +191,7 @@ localhost:5858
188191** NOTE: This is an experimental feature.**
189192
190193V8 Inspector integration allows attaching Chrome DevTools to Node.js
191- instances for debugging and profiling.
192- It uses the [ Chrome Debugging Protocol] [ ] .
194+ instances for debugging and profiling. It uses the [ Chrome Debugging Protocol] [ ] .
193195
194196V8 Inspector can be enabled by passing the ` --inspect ` flag when starting a
195197Node.js application. It is also possible to supply a custom port with that flag,
@@ -203,9 +205,13 @@ $ node --inspect index.js
203205Debugger listening on port 9229.
204206Warning: This is an experimental feature and could change at any time.
205207To start debugging, open the following URL in Chrome:
206- chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/ inspector.html?experiments=true&v8only=true&ws=localhost :9229/node
208+ chrome-devtools://devtools/bundled/ inspector.html?experiments=true&v8only=true&ws=127.0.0.1 :9229/dc9010dd-f8b8-4ac5-a510-c1a114ec7d29
207209```
208210
211+ (In the example above, the UUID dc9010dd-f8b8-4ac5-a510-c1a114ec7d29
212+ at the end of the URL is generated on the fly, it varies in different
213+ debugging sessions.)
214+
209215[ Chrome Debugging Protocol ] : https://chromedevtools.github.io/debugger-protocol-viewer/
210216[ TCP-based protocol ] : #debugger_tcp_based_protocol
211217[ V8 Inspector Integration ] : #debugger_v8_inspector_integration_for_node_js
0 commit comments