Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the Node.js `--nolazy` flag mean?

When I use --nolazy, I can finally debug asynchronously with IntelliJ, as breakpoints stop at the correct place. But I can't find any docs on --nolazy...

What does --nolazy mean?

like image 350
born2net Avatar asked Feb 03 '14 18:02

born2net


People also ask

How do I debug Node JS in Chrome?

Using Google Chrome DevTools to Debug The next step is to head to Chrome, open a new tab, and enter the URL chrome://inspect/ . Click on “Open dedicated DevTools for Node” to start debugging the application. It will take a couple of seconds to view the source code in Chrome DevTools.

How do I enable debug mode in Node JS?

Open up Preferences > Settings and in the search box type in “node debug”. Under the Extensions tab there should be one extension titled “Node debug”. From here, click the first box: Debug > Node: Auto Attach and set the drop down to “on”. You're almost ready to go now.


2 Answers

To let anyone know, if you debug node js (especially remote debug) and use async type coding which you kind of have to as this is the nature of node, you will to run node with the flag of -nolazy

node --nolazy --debug-brk sample1.js 

this will force V8 engine to do full compile of code and thus work properly with IntelliJ and WebStorm so you can properly place breakpoints in the code and not have to use the ;debugger; string which v8 looks for...

hope this helps someone, sure helped me :)

Sean.

like image 53
born2net Avatar answered Sep 18 '22 19:09

born2net


As others have said, you can see command line options for v8 with

node --v8-options 

There, you can see a listing for --lazy:

--lazy (use lazy compilation)       type: bool  default: true 

v8 uses a fairly common way to describe booleans - prefix the flag with no to set to false, and use just the flag to set to true. So --nolazy sets the lazy flag to false.

Note: node uses a slightly different convention - there, you use the no- prefix (note the dash) to set bools to false. For example, --no-deprecation is a node flag.

like image 38
Aaron Dufour Avatar answered Sep 19 '22 19:09

Aaron Dufour