-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Does not work with NPM workspaces #7103
Comments
For me, i just get stuck at However, it's working with electron-builder version 22 ! |
I am having the same or similar problem and found it started happening with npm 8.5.0 (node 16.14.1) because when I downgrade to 8.3.1 (that came with node 16.14.1) while keeping a higher node version, it works. Npm changelog says something about workspaces but I am not sure if its related. |
Try to add build option below in your {
"main": "build/electron/main.js",
...,
"build": {
...,
"npmRebuild": false
}
} |
Confirmed that setting It looks like this code is where the installing production dependencies happens: electron-builder/packages/app-builder-lib/src/util/yarn.ts Lines 86 to 120 in 01c6791
It seems to be running |
Setting npmRebuild to false works for me, but I worry disable rebuild may break native dependencies; Another problem is when depend on a non-exact electron version like It should use require.resolve() or require.resolve.paths() to search packages and not assume in {pwd}/node_modules |
I look into the code and figure out that create an empty node_module directory on the specific project where electron-builds solve my issue here. npm rebuild works fine in my case. See https://github.com/MuhammedKalkan/OpenLens/blob/c4b099462f9e4cdf405d02993a40e5563278bfd1/.github/workflows/main.yml#L47-L49 for a living example. electron-builder checks, if there is an node_modules dir on the current dir electron-builder/packages/app-builder-lib/src/util/yarn.ts Lines 11 to 16 in 80a3ae8
and if not, it just runs npm install again which may not work in An alternative solution is |
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 an issue |
Yes, still an issue: having to create an empty 'node_modules' folder on every workspace and having to fix the version of Electron on |
Very intereesting. Is there a proper way to detect if we're in a npm workspace and can discern that dependencies are already installed? |
(…or |
I'm wondering if I could just copy this implementation. |
It is important that the |
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. |
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 |
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 |
1 similar comment
still not stale |
Yes, still very much a difficult issue |
Implementation of |
For anyone looking for a workaround, here's the summary.
|
Electron Version: 20.1.0
Electron Type (current, beta, nightly): current
electron builder does not work in npm workspace
it deletes app-builder-bin during "installing production dependencies" and then throws error:
also it deletes more packages from node_modules, so next run throws
Reproduction:
npm run build -w a
in test-workspace.zipThe text was updated successfully, but these errors were encountered: