Debug with VSCode
See original GitHub issuePlease describe your issue: Unable to start/debug the app using VSCode.
Console output when you run electron-forge
with the environment variable DEBUG=electron-forge:*
. (Instructions on how to do so here. Please include the stack trace if one exists.
With below launch.json configuration,
"configurations": [
{
"name": "Launch Program",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd",
"program": "${workspaceRoot}/es6-init.js",
"cwd": "${workspaceRoot}"
}
]
I m getting below error:
c:\eapp/node_modules/.bin/electron.cmd --debug-brk=21609 --nolazy es6-init.js
App threw an error duri
ng load
Error: Cannot fi
nd module 'c:\eapp\--debug-brk=21609'
at Module._resolveFilename (module.js:455:15)
at Function.Module._resolveFilename (c:\eapp\node_modules\electron-prebuilt-compile\node_modules\electron\dist\resources\electron.asar\common\reset-search-paths.js:35:12)
With below launch.json configuration,
"configurations": [
{
"name": "Launch Program",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron-forge.cmd",
"cwd": "${workspaceRoot}",
"args": [
"start"
]
}
]
I m getting below error:
c:\eapp/node_modules/.bin/electron-forge.cmd --debug-brk=41000 --nolazy start
√ Checking your System
error: unknown option `--debug-brk'
What command line arguments are you passing?
Can be seen in above section
What does your config.forge
data in package.json
look like?
"forge": {
"make_targets": {
"win32": ["squirrel"],
"darwin": ["zip"],
"linux": ["deb","rpm"]
},
"electronPackagerConfig": {
"ignore": [
"node_modules/sqlite3/build",
"node_modules/sqlite3/deps",
"node_modules/sqlite3/src"
]
},
"electronWinstallerConfig": {
"name": "eapp",
"loadingGif": "./assets/img/install-splash.png",
"iconUrl": "http://manikanta.com/favicon.ico",
"setupIcon": "./assets/img/icon.ico",
"noMsi": true
},
"electronInstallerDebian": {},
"electronInstallerRedhat": {}
}
Can you please let me how to configure properly? Thanks.
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Debugging in Visual Studio Code
To run or debug a simple app in VS Code, select Run and Debug on the Debug start view or press F5 and...
Read more >Introduction to Debugging in Visual Studio Code
Debugging is a core feature of Visual Studio Code. In this tutorial, we will show you how to run and debug a program...
Read more >Debugger Extension - Visual Studio Code
Visual Studio Code's debugging architecture allows extension authors to easily integrate existing debuggers into VS Code, while having a common user ...
Read more >Debug Browser Apps using Visual Studio Code
The Visual Studio Code editor includes browser debugging support. Set breakpoints, step-in, inspect variables and more.
Read more >Debug Node.js Apps using Visual Studio Code
The JavaScript debugger of VS Code supports source maps that help debugging of transpiled languages, for example, TypeScript or minified/uglified JavaScript.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am unfamiliar with the fine art of attaching a debugger to the main Electron process and this isn’t really an issue with
electron-forge
rather a usage question regarding Electron itself which can be summarised as.“How can I debug the main process of Electron?”
A good guide exists in the Electron repository.
https://github.com/electron/electron/blob/master/docs/tutorial/debugging-main-process-vscode.md
If that guide doesn’t work you can ask for help in the Electron community or Slack Channel.
All this confusion is because even though I’ve mentioned
--debug=41000
, but still electron is starting5858
as debug port and thus VSCode is not able to attach to theport=41000
specified inlaunch.json
.Below is the command line args of the app process tree.
Parent node process is having correct command line args: (
--debug=41000
)Child node process is having incorrect command line args: (
--debug 41000
) (mind the missing=
)Now I’ve changed to
port=5858
in VSCode’slaunch.json
and is attaching properly.But I m not sure why it is like this 😦