Pre-flight checklist
Electron Forge version
6.0.0-beta.61
Electron version
16.0.4
Operating system
Windows 11 21H2 22000.376
Last known working Electron Forge version
No response
Expected behavior
The app launches under debug mode with VSCode.
Actual behavior
An unhandled rejection has occurred inside Forge:
node_modules/@electron-forge/cli/dist/util/terminate.js:10
Error: Could not find any Electron packages in devDependencies
at getElectronModuleName (C:\git\Focalist\node_modules@electron-forge\core\src\util\electron-version.ts:62:11)
at getElectronVersion (C:\git\Focalist\node_modules@electron-forge\core\src\util\electron-version.ts:99:23)
at _default (C:\git\Focalist\node_modules@electron-forge\core\src\api\start.ts:52:11)
at C:\git\Focalist\node_modules@electron-forge\cli\src\electron-forge-start.ts:58:19
Steps to reproduce
- Set up a repository with NPM workspaces, and the electron project under one subdirectory
- Run
npm i to install dependencies to node_modules
- Add the recommended launch.json setup for debugging to VS code:
{
"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
"runtimeArgs": [
"foo",
"bar"
],
"cwd": "${workspaceFolder}"
}
- Launch the app with F5
Additional information
I also tried adding the electron packages to devDependencies in the root package.json and got this error window:
[Window Title]
Error
[Main Instruction]
Error launching app
[Content]
Unable to find Electron app at C:\git\Focalist
Cannot find module 'C:\git\Focalist'
Require stack:
- C:\git\Focalist\node_modules\electron\dist\resources\default_app.asar\main.js
I then changed the cwd to "${workspaceFolder}/electron" (my workspace folder) and VS got into the "debug" mode with the orange status bar, but the electron app didn't launch.
The only workaround I can think of is switching to yarn workspaces: that can prevent hoisting and keep more packages in the app's node_modules, which might let the launch work correctly.
Pre-flight checklist
Electron Forge version
6.0.0-beta.61
Electron version
16.0.4
Operating system
Windows 11 21H2 22000.376
Last known working Electron Forge version
No response
Expected behavior
The app launches under debug mode with VSCode.
Actual behavior
An unhandled rejection has occurred inside Forge:
node_modules/@electron-forge/cli/dist/util/terminate.js:10
Error: Could not find any Electron packages in devDependencies
at getElectronModuleName (C:\git\Focalist\node_modules@electron-forge\core\src\util\electron-version.ts:62:11)
at getElectronVersion (C:\git\Focalist\node_modules@electron-forge\core\src\util\electron-version.ts:99:23)
at _default (C:\git\Focalist\node_modules@electron-forge\core\src\api\start.ts:52:11)
at C:\git\Focalist\node_modules@electron-forge\cli\src\electron-forge-start.ts:58:19
Steps to reproduce
npm ito install dependencies tonode_modulesAdditional information
I also tried adding the electron packages to devDependencies in the root
package.jsonand got this error window:I then changed the cwd to
"${workspaceFolder}/electron"(my workspace folder) and VS got into the "debug" mode with the orange status bar, but the electron app didn't launch.The only workaround I can think of is switching to yarn workspaces: that can prevent hoisting and keep more packages in the app's
node_modules, which might let the launch work correctly.