How do I debug Node.js applications?
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.
How to debug node.js application with Visual Studio 2013 and Node Tools NTVS
For everyone who asks receives, and the one who searches finds....
(and yes, I did spend a long time searching and trying before posting here..)
Kind of nice to debug node.js server with VS..
hope this helps someone
Edit: The arguments to node.exe can be hard to read in the image. It must be
--debug=<portno>
that is with two dashes (and not just one) to specify the debug port.
How do I debug Node.js applications?
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.
How Run-Script works in VS Code for node.js applications when debugging?
Here are the steps to solve your mystery: by following along, you'll both discover the task configuration settings for the elusive option, and discover how it was added to your list:
Create an empty folder (I named mine
so-70196209
after this question ID), and open it in a new VS Code workspace.Create a
package.json
file in the folder. Make sure it has astart:debug
script entry like this:package.json
:{
"name": "so-70196209",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start:debug": "echo \"Success\"",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT"
}In the VS Code menu, select "Run" > "Add Configuration..."
In the list that appears, select "Node.js":
A file at
.vscode/launch.json
will be created with a default task like this:.vscode/launch.json
:{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${file}"
}
]
}You can delete this default task later if you don't want to keep it, but just leave it for now and follow along to the end.
Select the "Run and Debug" icon in the Activity Bar.
In the "Run and Debug" Side Bar, select the dropdown menu and choose "Node.js...":
In the list that appears, find the entry with the text "Run Script: start:debug". Find the gear icon on the right, and select the gear.
If you hover over the gear, a tooltip will appear with the text "Edit Debug Configuration in launch.json"
This will add a new entry to
.vscode/launch.json
, and this entry is the one that you've been searching for. (The reason why it wasn't in your launch config, but was in your dropdown list, is because you previously clicked the entry line at some point, but not the gear. I don't know why this adds it to the dropdown and not the config, but that's how it works right now.)The config file now looks like this:
.vscode/launch.json
:{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${file}"
},
{
"type": "node-terminal",
"name": "Run Script: start:debug",
"request": "launch",
"command": "npm run start:debug",
"cwd": "${workspaceFolder}"
}
]
}The "Run and Debug" dropdown menu now has the entry you want:
Problem solved! /p>
Related Topics
Variable Name as a String in JavaScript
Difference Between Two Dates in Years, Months, Days in JavaScript
Hide Scrollbar and Show on Hover Like Facebook's New Chat Sidebar
Limit Labels Number on Chart.Js Line Chart
Resetting the Opacity of a Child Element - Maple Browser (Samsung Tv App)
Iterating Over Result of Getelementsbyclassname Using Array.Foreach
How to Chain and Share Prior Results With Promises
JavaScript and Operator Within Assignment
What Are Alternatives to Document.Write
Curly Brackets in Arrow Functions
Converting Between Strings and Arraybuffers
Is It Not Possible to Stringify an Error Using Json.Stringify
Changing Background Based on Time of Day (Using JavaScript)
Polymer Share Styles Across Elements
Why Does ++[[]][+[]]+[+[]] Return the String "10"
Count Animation from Number a to B