I'm trying to debug my node script that is running in Visual Studio Code. My first mistake (apparently) was I pressed the Debug menu choice. It launched the .net debugger (this is actually an asp.net core project) but I wanted to debug just the node server that I launched myself.
Now, when I bring up the terminal windows, the only choice seems to be type powershell (see red arrow).
What I want to do is debug my running node script that I started by typing "node start dev".
{
"version": "0.2.0",
"configurations":
[
{
"name": "node",
"type": "node",
"request": "launch",
"stopOnEntry": false,
"program": "${file}",
"cwd": "${workspaceFolder}",
"args": [
"start", "dev"
]
}
]}
Related
There are two types of configurations in vscode debugging,
Launch via NPM and Launch via npm
I tried but didn't find the docs anywhere
What's the difference between those?
// #launch via NPM
{
"type": "node",
"request": "launch",
"name": "Launch via NPM",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"debug"
],
"port": 9229,
"skipFiles": [
"<node_internals>/**"
]
},
// #launch via npm
{
"name": "Launch via NPM",
"request": "launch",
"runtimeArgs": [
"run-script",
"debug"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
}
I get an answer from vscode dev: https://github.com/microsoft/vscode/issues/127232
There is no real difference: the launch config with the "port" attribute is contributed by the legacy node.js debugger and will disappear soon. The second launch config is more recent and comes from js-debug.
Since the legacy debug configurations are automatically redirected to js-debug and since port 9229 is the default debug port anyway, there should be no differences.
I am trying to debug Deno using VSCode on Ubuntu 20.04 LTS running inside WSL-2. I setup my launch.json as described in the Deno manual:
{
"version": "0.2.0",
"configurations": [
{
"name": "Deno",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "deno",
"runtimeArgs": ["run", "--inspect-brk", "-A", "${fileBasename}"],
"outputCapture": "std",
"port": 9229
}
]
}
however when I launch Deno the "--inspect-brk" option is being stripped out from the command used to launch Deno. If I modify my launch.json to change the option to "inspect-brk" (removing the leading --) the option shows up on the command line and I get the error:
Cannot resolve module "file:///mnt/c/Users/mlwp/projects/deno/inspect-brk"
Similarly if I change the name of the option to be "--inspect-brk-fun" then I get the message:
Found argument '--inspect-brk-fun' which wasn't expected, or isn't valid in this context
Anyone know why VSCode would strip the option or how to debug this
The cause of your issue was an incompatibility with --inspect-brk in previous versions of the VSCode JavaScript debugger. It has been fixed some time ago and so have the Deno docs on this matter, where the value of type has changed and port has been replaced with attachSimplePort in launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Deno",
"type": "pwa-node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "deno",
"runtimeArgs": ["run", "--inspect-brk", "-A", "${file}"],
"attachSimplePort": 9229
}
]
}
However, I've found that using your current configuration should also work on newer releases (1.47+) of VSCode (running on Ubuntu 20.04 in WSL 2).
I am trying to use debug mode in my react native application with visual studio code. I am using the command npx react-native run-android. It is activating the react native debugger, but it is not reaching any breakpoint in my application.
I did not find any tutorials to activate debug with npx, so could you guys show me one or explain me what is happening wrongly in this setup?
this is my launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug React Native",
"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "launch",
"platform": "android",
"sourceMaps": true,
"outDir": "${workspaceRoot}/.vscode/.react"
},
]
}
An interesting thing it is happening is once it is running the application if I click on the start debugging button my application restarts and it shows a message on debug console:
Launched debug configuration contains 'program' property which is deprecated and will be removed soon. Please replace it with: "cwd": "${workspaceFolder}"
Could not debug. The "path" argument must be of type string. Received type undefined
Since I have not received any answer, I took 3 days to discovered what was happening.
this is the correct configuration:
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to packager",
//"program": "${workspaceRoot}/.vscode/launchReactNative.js",
"type": "reactnative",
"request": "attach",
"sourceMaps": true,
"cwd": "${workspaceFolder}",
//"outDir": "${workspaceRoot}/.vscode/.react"
},
]
}
Must run the command npx react-native run-android
Once the android emulator is running batch job must be stopped in the terminal
Go to the debug tab in vs code and run the application
ctrl + m on android emulator
click on debug option
Those were the baby steps that I did in order to have the application run in debug mode.
I use Visual Studio Code 1.37.1, OS Windows 10. I have installed F# with Ionide.
How can I launch the code to redirect user input to a file as I would do with Visual Studio 2019 ("< in.txt" in CommandLineArgs Option of the debugger).
Thank you !
It is related to this and not F# specific.
In launch.json
{
"name": "someName",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/path/to/someName.dll",
"args": ["<", "${workspaceFolder}/path/to/file.txt"],
"console": "internalConsole",
}
works with internalConsole for me.
I would like to debug my office-js application (with angular2) within VS-Code.
My launch.json is:
"configurations": [
{
"sourceMaps": true,
"type": "node",
"request": "attach",
"port": 4200,
"name": "Launch Program",
"outFiles": [
"${workspaceRoot}/*.js"
]
}
Currently I'm using Atom Editor with angular cli and "ng serve" command and VS Community Edition 2017 as debugger. It works with "Attach to Process" (iexplore) and I'm able to debug my Word AddIn.
For simplification I tried to move to VS-Code which -for my understanding- supports inline debugging.
In launch.json, "type" could be "node", "chrome", "edge", "firefox" but I didn't found iexplore which I would need in my opinion.
Thank you in advance for sharing your expierences.
There are a number of debuggers in the extension marketplace but I'm not aware of one for Internet Explorer.