forge icon indicating copy to clipboard operation
forge copied to clipboard

VSCode debug not launching application

Open mijlouis opened this issue 3 years ago • 1 comments

Pre-flight checklist

  • [X] I have read the contribution documentation for this project.
  • [X] I agree to follow the code of conduct that this project uses.
  • [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

6.0.0-beta.63

Electron version

v17.2.0

Operating system

Windows 10 (19042)

Last known working Electron Forge version

No response

Expected behavior

Being able to debug electron-forge application in VSCode

Actual behavior

With the vscode launch config provided in the documentation

    {
      "type": "node",
      "request": "launch",
      "name": "Electron Main",
      "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron-forge-vscode-nix",
      "windows": {
        "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron-forge-vscode-win.cmd"
      },
      // runtimeArgs will be passed directly to your Electron application
      "outputCapture": "std",
      "env": {
        "DEBUG": "electron-forge:*"
      },
      "runtimeArgs": [
        "foo",
        "bar"
      ],
      "cwd": "${workspaceFolder}"
    },

I am not able to get the application launched.

Steps to reproduce

When I start debugging my project through vscode, the step Launch Application is not triggered (no appropriate comment in the DEBUG CONSOLE of vscode). It says that the debugger is attached but the application does not start and thus, no breakpoint that I have set are hit.

image

When I start the project normally through npm run start everything works fine and the application starts.

image

What could be the reason for this?

Thanks in advance for your help and Best Regards

Additional information

No response

mijlouis avatar Mar 31 '22 13:03 mijlouis

In my case, I solved it by setting "console": "integratedTerminal" in launch.json instead of "outputCapture": "std".

I hope this helps.

goemoncode avatar Sep 18 '22 10:09 goemoncode

I don't understand that launch.config.

Instead of using it I use this .vscode/launch.json and run the Run npm start debugging target:

{
  // 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": [
    {
      "command": "npm start",
      "name": "Run npm start",
      "request": "launch",
      "type": "node-terminal"
    },
    {
      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "skipFiles": ["<node_internals>/**"],
      "program": "${workspaceFolder}\\webpack.plugins.ts",
      "preLaunchTask": "tsc: build - tsconfig.json",
      "outFiles": ["${workspaceFolder}/dist/**/*.js"]
    }
  ]
}

That executes (and lets me debug) the electron-forge-start script -- but if I set a breakpoint in my source code for the Electron main process, then it will break there too, after that process is started.

cwellsx avatar Nov 19 '22 20:11 cwellsx