electron-builder: Does not work with NPM workspaces

  • Electron-Builder Version: 23.3.3
  • Node Version: v18.3.0
  • Electron Version: 20.1.0

  • Electron Type (current, beta, nightly): current

  • Target: win32 x64

electron builder does not work in npm workspace it deletes app-builder-bin during “installing production dependencies” and then throws error:

• packaging       platform=win32 arch=x64 electron=20.1.0 appOutDir=dist\win-unpacked
The system cannot find the path specified.
  ⨯ spawn C:\Users\user\dev\test-workspace\node_modules\app-builder-bin\win\x64\app-builder.exe ENOENT

also it deletes more packages from node_modules, so next run throws

'electron-builder' is not recognized as an internal or external command

Reproduction: npm run build -w a in test-workspace.zip

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 12
  • Comments: 20 (9 by maintainers)

Most upvoted comments

still not stale

not stale

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

still not stale

still not stale

Very intereesting.

Is there a proper way to detect if we’re in a npm workspace and can discern that dependencies are already installed?

Yes, still an issue: having to create an empty ‘node_modules’ folder on every workspace and having to fix the version of Electron on package.json is very annoying…

Try to add build option below in your package.json which has main entry for electron app:

{
  "main": "build/electron/main.js",
  ...,
  "build": {
    ...,
    "npmRebuild": false
  }
}