You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dependencies are not packaged by electron-builder when using pnpm #6289
I'm having issues trying to use pnpm and electron-builder. I tried multiple times to package the app using basic commands and build configurations from online guides but i would always get dependency related errors after packaging it.
Initially i thought it was my configuration error, but after copying the whole project and used npm instead, everything worked as expected.
From what i could find, it seems that electron-builder can't resolve the dependencies within the .pnpm folder, but i am not 100% certain of this.
pnpm and electron-builder are both great would love to have this fixed
Build config
Using pnpm
As shown in the screenshot, semver already exist in node_modules/.pnpm
Using npm with same exact build config
Application is built with no errors by electron-builder
Run into same problem, the node_modules folder bundled in app.asar does not contain modules installed under .pnpm/, which are symlinks created by pnpm install.
Hey guys!
Do you have any plans to support pnpm?
It reduces pain for developers that have gigabytes of node_modules placed here and there.
Would love to use it with electron too.
I've tried other alternatives for reading dependency trees and they aren't viable. I'm not sure how app-builder works, but it seems like it just needs to also search node_modules/.pnpm/node_modules/* for all dependencies
set public-hoist-pattern = * or shamefully-hoist = true in .npmrc
Choose any of them. The problem will be solved.
Of course, it would be great if electron-builder could support it.
Update:
If your dependencies have multiple versions, it's best to add node-linker = hoisted to avoid having only one version selected during packaging. Refer to the link for more information: pnpm/pnpm#5724 (comment)
Reacted by enncy, 陈富强, ConteMan and 雷明
Reacted by Mike Maietta, JW, Asineth and Callan Bi
@BlackHole1 thanks for the suggested solution. This is probably an acceptable solution for some however the suggested approach is basically throwing away the benefits of using pnpm in the first place.
The repo's readme also links to a comment about why yarn should be used however with 129 downvotes and 94 confused emojis it's clearly not backed by the community running into these issues.
I'm not able to provide a better solution myself but I'd like to point out how much of a hurdle this is for adoption. We're not prepared to relax the reliability of our dependency system that pnpm brings to our monorepo. Changing this for a single package is an unreasonable ask. I hope there is a path forward soon; A fundamental library shouldn't have to compromise it's audience based on a package manager.
Reacted by Miguel Valadez, Toby Harris, Arthur Caillaud, Kevin Cui, LClancey, Andrey (Andrii) Los, Kamas "Iceberg" Lau, Yagiz Nizipli and itsMapleLeaf
Reacted by Mike Maietta, Kevin Brown and Yagiz Nizipli
Activity
mmaietta commentedon Sep 26, 2021
@develar can you please take a look at this when you have a chance?
cangzhang commentedon Sep 28, 2021
Run into same problem, the
node_modulesfolder bundled inapp.asardoes not contain modules installed under.pnpm/, which are symlinks created bypnpm install.plimeor commentedon Oct 11, 2021
Any updates?
cah4a commentedon Nov 19, 2021
Hey guys!
Do you have any plans to support pnpm?
It reduces pain for developers that have gigabytes of
node_modulesplaced here and there.Would love to use it with electron too.
mmaietta commentedon Nov 21, 2021
I don't have plans to implement the support for pnp. But I'd happily review PRs for it! 🙂
cupcakearmy commentedon Jan 21, 2022
Same here, would be awesome to have support for it
mmaietta commentedon Feb 5, 2022
Quick test, can someone try setting
.npmrcto copy from the global pnpm store for deps?https://pnpm.io/npmrc#package-import-method
monsterkodi commentedon Feb 6, 2022
I tried the
copysetting. But doesn't seem to make any difference for me.mmaietta commentedon Feb 9, 2022
@develar really could use your help on this one. Seems to be failing with
readDependencyTreein yourapp-builderproject.https://github.com/develar/app-builder/blob/c79345743b794ccef41493decafb0b5b2eece505/pkg/node-modules/tree.go#L41
I've tried other alternatives for reading dependency trees and they aren't viable. I'm not sure how app-builder works, but it seems like it just needs to also search
node_modules/.pnpm/node_modules/*for all dependenciesBlackHole1 commentedon Feb 17, 2022
Choose any of them. The problem will be solved.
Of course, it would be great if electron-builder could support it.
Update:
If your dependencies have multiple versions, it's best to add
node-linker = hoistedto avoid having only one version selected during packaging. Refer to the link for more information: pnpm/pnpm#5724 (comment)CallanBi commentedon Feb 24, 2022
Same. Would really love to see it is supported.
the0rem commentedon Feb 24, 2022
@BlackHole1 thanks for the suggested solution. This is probably an acceptable solution for some however the suggested approach is basically throwing away the benefits of using pnpm in the first place.
The repo's readme also links to a comment about why yarn should be used however with 129 downvotes and 94 confused emojis it's clearly not backed by the community running into these issues.
I'm not able to provide a better solution myself but I'd like to point out how much of a hurdle this is for adoption. We're not prepared to relax the reliability of our dependency system that pnpm brings to our monorepo. Changing this for a single package is an unreasonable ask. I hope there is a path forward soon; A fundamental library shouldn't have to compromise it's audience based on a package manager.
stale commentedon Apr 28, 2022
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
cah4a commentedon Apr 28, 2022
Any progress here?
mmaietta commentedon Apr 28, 2022
Issue is in upstream dependency app-builder (node_modules/app-builder-bin)
Ref: #6289 (comment)
You're welcome to file a ticket here https://github.com/develar/app-builder
Workaround is: #6289 (comment)