Skip to content

electron-forge does not work with npm workspaces (npm v7) #2306

@mangnus

Description

@mangnus

Preflight Checklist

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

Issue Details

  • Electron Forge Version: 6.0.0-beta.57
  • Electron Version: 13.1.0
  • Operating System: macOS 11.4
  • Last Known Working Electron Forge version:: N/A

Expected Behavior

Running electron-forge start from project root (npm run start --workspace="packages/electron-app") or from electron workspace root (cd packages/electron-app && npm run start) should be able to locate the electron executable in the project root node_modules.

Actual Behavior

Running electron-forge start throws a PackageNotFoundError:

An unhandled rejection has occurred inside Forge:
PackageNotFoundError: Cannot find the package "electron". Perhaps you need to run "yarn install" in "<path-to-project-root>/packages/electron-app"?

To Reproduce

Minimal repro example: https://github.com/brightbrained/electron-forge-workspaces

Make sure to have npm v7 or above for workspaces support (npm install --global npm@latest)

git clone https://github.com/brightbrained/electron-forge-workspaces.git
cd electron-forge-workspaces
npm install
npm run start --workspace="packages/electron"

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions