question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Debug with VSCode

See original GitHub issue

Please 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:closed
  • Created 7 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
MarshallOfSoundcommented, Dec 30, 2016

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.

0reactions
manikantagcommented, Dec 31, 2016

All this confusion is because even though I’ve mentioned --debug=41000, but still electron is starting 5858 as debug port and thus VSCode is not able to attach to the port=41000 specified in launch.json.

Below is the command line args of the app process tree.

Parent node process is having correct command line args: (--debug=41000) image

Child node process is having incorrect command line args: (--debug 41000) (mind the missing =) image

Now I’ve changed to port=5858 in VSCode’s launch.json and is attaching properly.

But I m not sure why it is like this 😦

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found