-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't build electron app due to dependency on parent folder #53
Comments
Here is the output on macOS:
It's actually not quite what I remembered. But I still suspect the same underlying cause. |
I tried adding as a workaround in forge.config.js: ignore: [
// This project, which is a subfolder of the main project,
// the main project (core library) being a dependency of this project
"tracky-mouse-electron", but that didn't help. |
I restructured the project as a monorepo, and this does help, but using npm workspaces creates its own problems. I'm now running up against:
With npm workspaces, dependencies are now hoisted by npm, and Electron Forge doesn't find the dependencies. I tried adding an # install-strategy is needed for the electron app to be packaged correctly.
# If the dependencies are hoisted, electron-forge will fail to find them.
install-strategy=linked But this is buggy, as noted in the output:
I may need to ditch npm workspaces, and just use separate packages that aren't "workspaces", in order to have separate Or I may be able to delete the package locks other than the root one, and build the app if Electron Forge actually supports looking at one package.json but not nested ones, and that's the only issue, but this will have the downside of requiring installing heavy dependencies including native modules just to hack on the website, which is inefficient and may be prohibitive to contributors. I could also try the |
I tried adding "desktop-app/node_modules/serenade-driver": {
"resolved": "node_modules/.store/serenade-driver@1.1.13-O_NKL07TXUFDJP_AO9lS3A/node_modules/serenade-driver",
"link": true
},
"node_modules/.store/serenade-driver@1.1.13-O_NKL07TXUFDJP_AO9lS3A": {},
"node_modules/.store/serenade-driver@1.1.13-O_NKL07TXUFDJP_AO9lS3A/node_modules/serenade-driver": {
"version": "1.1.13",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
"bindings": "^1.5.0",
"node-addon-api": "^3.1.0",
"windows-shortcuts": "^0.1.6"
}
},
"node_modules/.store/serenade-driver@1.1.13-O_NKL07TXUFDJP_AO9lS3A/node_modules/serenade-driver/node_modules/bindings": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"dependencies": {
"file-uri-to-path": "1.0.0"
}
},
"node_modules/.store/serenade-driver@1.1.13-O_NKL07TXUFDJP_AO9lS3A/node_modules/serenade-driver/node_modules/node-addon-api": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz",
"integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A=="
},
"node_modules/.store/serenade-driver@1.1.13-O_NKL07TXUFDJP_AO9lS3A/node_modules/serenade-driver/node_modules/windows-shortcuts": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/windows-shortcuts/-/windows-shortcuts-0.1.6.tgz",
"integrity": "sha512-kjkb3Hmmmg7jwnOb+29AOmoEEA1L/JeLsMOYovpLxYpuc+fN0R+pr8sMwep3JFhUZloxyw1XTzq8n3HugXkqBA=="
}, and running Then I tried deleting all the package locks again along with the
Weird that's trying to remove a directory during a clean install, but I've been having these sort of permission errors come and go for a while now.
I then tried using the default
So I'm going to have to ditch npm workspaces, and maybe switch package managers in the future to get a nicer monorepo workflow... that actually works. |
Electron Forge doesn't work with npm workspaces. See: #53 And: electron/forge#2306 And: npm/cli#7029 And: npm/rfcs#287 This gets the app working when packaged.
Ditched npm workspaces and got the app building.
I replaced the I could explore other options in the future for improving the developer experience around the monorepo setup, like:
|
npm run make
gives this error on Windows:on macOS, the error is clearer, because it shows the path it created contains a cycle of the two directories, repeating over and over.
The electron app depends on
"tracky-mouse": "file:.."
.It's not a cyclic dependency; the
tracky-mouse
package doesn't depend on thetracky-mouse-electron
package, but thetracky-mouse
folder does contain thetracky-mouse-electron
folder, so it gets into a loop of trying to include it.I might need to separate the products into sibling folders, at which point there wouldn't be a package.json at the root of the repo...
It might be time that I need to learn about monorepos, since this project contains two products (core library and desktop app), with a third planned (a browser extension).
There may be simple workaround, though.
The text was updated successfully, but these errors were encountered: