I copypaste launch.json from different project into vscode folder in project folder and substitute paths to files. When i start debugger i got the following error:
Error: Cannot find module 'c:\Users\Anatoly\Desktop\project_folder --inspect=34947' at Module._resolveFilename (module.js:470:15)
Could you please point out to me what may be the reason for such an error? Thank you!
This is launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/app/main.ts",
"stopOnEntry": false,
"args": ["."],
"cwd": "${workspaceRoot}",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd",
"outFiles": [
"${workspaceRoot}/dist/main.js"
],
"protocol":"inspector",
"env": { },
"sourceMaps": true
}
]
}
To bring up the Run and Debug view, select the Run and Debug icon in the Activity Bar on the side of VS Code. You can also use the keyboard shortcut Ctrl+Shift+D. The Run and Debug view displays all information related to running and debugging and has a top bar with debugging commands and configuration settings.
If you're only interested in debugging a Python script, the simplest way is to select the down-arrow next to the run button on the editor and select Debug Python File in Terminal.
To start debugging, select F5, or choose the Debug Target button in the Standard toolbar, or choose the Start Debugging button in the Debug toolbar, or choose Debug > Start Debugging from the menu bar. The app starts and the debugger runs to the line of code where you set the breakpoint.
To set a breakpoint in source code: Click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.
I ran into this error myself. In my case, I had simply forgotten to run npm install
to install all the project's dependencies before trying to debug the program. Silly error on my part.
I think your program is using the root when when should be using folder. Try ${workspaceFolder}/app/main.ts rather than ${workspaceRoot}.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With