Asked  7 Months ago    Answers:  5   Viewed   31 times

How do I debug a Node.js server application?

Right now I'm mostly using alert debugging with print statements like this:

sys.puts(sys.inspect(someVariable));

There must be a better way to debug. I know that Google Chrome has a command-line debugger. Is this debugger available for Node.js as well?

 Answers

55

The V8 debugger released as part of the Google Chrome Developer Tools can be used to debug Node.js scripts. A detailed explanation of how this works can be found in the Node.js GitHub wiki.

Tuesday, June 1, 2021
 
turson
answered 7 Months ago
42

[VM] (scriptId) has no special meaning. It's a dummy name to help us to distinguish code which are not directly tied to a file name, such as code created using eval and friends.

In the past, all of these scripts were just labelled (program).

If you're interested, just look up "[VM]"in the source code of Chromium, you will discover that these numbers have no significant meaning outside the developer tools.

update 2015-06-25

[VM] (scriptId) was renamed to VMscriptId a while ago, and here is the direct link to search result in case the value changes again.

Sunday, June 6, 2021
 
MassiveAttack
answered 6 Months ago
67

Here is the answer, thanks to Hans Passant. Note that this solution raises additional questions.

  1. Ensure https://referencesource.microsoft.com/ contains the exact version you're debugging.

    • How? Reference source specifies ".NET Framework 4.6.2" but a module version is something like: "4.6.1586.0"
    • You may need to uninstall security updates as explained here: How do you enable "Enable .NET Framework source stepping"?
  2. Configure Visual Studio as specified here: https://referencesource.microsoft.com/setup.html

    • Untick "Enable Just My Code"
    • Tick "Enable .NET Framework source stepping" (this should have been the only step needed)
    • Tick "Enable source server support"
    • Untick "Require source files to exactly match the original version"
  3. Confirm symbols are loaded in the Modules window, with source indexing included.

    • How can you tell if source indexing is included? The modules window doesn't specify if a PDB has stripped source information.

Microsoft could make this process a lot more robust by giving helpful error messages instead of silently failing.

Wednesday, June 23, 2021
 
Sujith
answered 6 Months ago
25

Found answer on Remote Debugging WebViews on Google Developers.

This method has been added in API Level 19, hence had to add following check

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
  WebView.setWebContentsDebuggingEnabled(true);
}

As mentioned in documentation, this method does not respect debuggable flag in application manifest file. If you want to enable webview debugging only when debuggable flag is true, then add one more check

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
  if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE))
  { 
    WebView.setWebContentsDebuggingEnabled(true); 
  }
} 
Tuesday, November 16, 2021
 
mahclark
answered 2 Weeks ago
93

You see jQuery as the handler because you used jQuery to make those listeners. jQuery code is called when event is triggered. If you used normal JS addEventListener, they will show up in the event without having to step through.

According to the article here the feature is coming in Firefox 34, so if you use Firefox beta it should have the behavior you want.

Monday, November 29, 2021
 
Kerrek SB
answered 3 Days ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :  
Share