forge icon indicating copy to clipboard operation
forge copied to clipboard

package.json local paths are not supported

Open mmarczell-graphisoft opened this issue 1 year ago • 2 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.1.1

Electron version

v24.3.0

Operating system

macOS 13.3.1

Last known working Electron Forge version

No response

Expected behavior

npx electron-forge make succeeds.

Actual behavior

It outputs an error message saying

An unhandled rejection has occurred inside Forge: Error: ENOENT: no such file or directory, stat '/private/var/folders/4c/w1bj9h4d5_df436ckn8xxmqr0000gq/T/electron-packager/darwin-x64/BIMx-darwin-x64-bvme29/Electron.app/Contents/Resources/app/node_modules/connector'

Steps to reproduce

Have a dependency in package.json specified by a relative path like this: (see npm docs)

"dependencies": {
    "foo": "file:../../foo/foo.node"
}

Run npx electron-forge make.

Additional information

No response

mmarczell-graphisoft avatar May 19 '23 13:05 mmarczell-graphisoft

anyupdate?

himself65 avatar Jun 14 '23 04:06 himself65

I'm trying to reuse code between web and desktop. This, to me, is Electron's core value proposition. I have created a monorepo setup to facilitate this:

  • /
    • package.json (would use npm workspaces but Electron Forge doesn't support it)
    • core/
      • package.json
    • desktop-app/
      • package.json (includes ../core as a dependency)
    • website/ (includes a demo of the library, which is basically the full app embedded in a webpage)
      • package.json

Packaging with a relative path dependency works on Windows, but fails on macOS and Linux.

As of @electron-forge/[email protected], the error is swallowed, and the CLI exits unceremoniously. In previous versions, the error showed up when the CLI exited. The error can be surfaced on 7.4.0 by using DEBUG=electron-packager.

1j01 avatar Apr 20 '24 06:04 1j01