-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
"Cannot find module 'sharp'" on Windows only after upgrading to 26.0.11 #8970
Comments
Hiya! Can you share a minimum reproducible repo that I can test locally with and/or create a unit test around? Would like to assist but need more information first. |
Hey @mmaietta thanks for your reply. I did find the problem - in
Simply removing this is enough of a fix for us and probably only adds a tiny bit to the package size, but I do wonder why that would now be breaking in 26.x (and seemingly only on Windows.) Thanks again! |
Actually, I must have overlooked something because that's definitely not resolving the issue now... |
Hm... I really thought I had this working but every attempt now results in this same issue. I'm not sure if I changed something else or if what I thought fixed it never really did. I'll update soon. |
@mmaietta I did notice that there's nothing under |
Yeahhhh, definitely need a minimum repro repo for this unfortunately. The node collector logic was completely migrated to TS from Golang to support pnpm amongst other things, and a migration to |
Thanks as always for the great work and for your help @mmaietta! I put together a repro here: https://github.com/Nantris/electron-builder-repro-8970 It requires Yarn v4 (which I think should be used automatically as long as you have corepack enabled?) Repro steps:
This isn't an exact copy of our config and may not be 100% correct in every regard, but it should at least output the |
Well this is odd indeed. Your |
Thanks as always for all you do @mmaietta! I was wondering if it might be related to Yarn 4 myself. We upgraded from 25.1.8 and I believe I verified this affects 26.0.0 specifically but I'm not certain now. It's super strange to me that while Windows fails, Linux builds remain unaffected. I haven't had a chance to test macOS. Maybe there's some sort of path issue that makes this only work on POSIX? |
I confirmed macOS is unaffected. So only Windows has the problem. I also tried setting |
I am experiencing this issue too, but with a different dependency. this works with 26.0.2 (before the node_module collector change), but not with 26.0.11. I am using yarn 4.7.0 If I look inside the app.asar, there is no node_modules folder at all, we have 10+ direct dependencies that should be included there. I should add a disclaimer that we are using a lightly patched app-builder-lib, but that should only be including more node_modules than usual loose inside the resources directory. The snippet of our config that I expect could affect this is:
|
@beyondkmp can you please take a look at this when you have a chance? Seems there's an issue specifically on Windows, and it may be specific to yarn 4. I'm trying to write a unit test from my side, but once corepack is enabled in the docker container to support a yarn4-scoped test, subsequent runs of other unit tests break due to corepack now being enabled. |
@mmaietta that's very strange! Because our macOS build worked unless I'm crazy. Edit: Reconfirming macOS built properly with |
Hmmm, I'm running off latest I was able to resolve the dependency collection by changing the
Trying to figure out how to get around this issue now, as at least the dependency tree is being returned correctly. Suggestions welcome as I'm still pretty sick and my mind is an absolute ball of fuzz right now |
I'm getting similar problem on 26.0.11 - multiworkspace project, unpacking asar shows there are no node_modules there at all. |
@stq, is that also a yarn 4 project? |
No, npm9/node20. Downgrading to 26.0.2 fixed issue. |
@stq would you mind putting together a minimum reproducible repo since yours isn't yarn 4? I'd like to create a dedicated unit test for this multi-workspace project as we already have some two-package.json app fixtures, but it seems like we're missing a use case. |
@Nantris can you try this patch-package? It works all of a sudden for me on macos target, still need to setup a test env in a windows VM though
|
@mmaietta I'm sorry to report it didn't resolve the issue. But macOS always worked for us, so maybe there are two issues here? It's pretty confusing. |
@mmaietta you're testing on the master branch, right? Unfortunately I can't get that working here, apparently due to this issue, so I guess we may be testing slightly different setups. That image is from macOS, right? |
This will include all dependencies from projectDir, while the dependencies in appDir should only be a subset of projectDir's dependencies and don't need to be entirely included. |
Should be the same setup. That was on a default |
@mmaietta this is my bad, but actually even more confusing. Originally I tested against our project and not against the repro. The patch works on the repro :) Does not work on our project :( Edit 1: Investigating further. If I come across anything I'll update. |
Oh lordy, this is becoming a conundrum n' a half. I was going to suggest this as an easy fix. Checks the
But since it doesn't work for your original/source project, I'm not sure where to go from here either. Might need @stq to get back to us on a minimum repro project so I can do a deeper dive since this doesn't seem isolated to yarn 4. Might be due to multi-workspace setups, which is my hunch, but I need a local setup to repro and write a unit test for. Otherwise I'm just stabbing in the dark to find a needle in a haystack 😅 I think it may be useful to add a |
The repro I provided does indeed fail for me on macOS, whereas my project does not.
Seems very possible, since our project is indeed a Yarn workspace, but all the native deps are at the project root so one wouldn't think it would be the cause, but it's the most promising theory I'd say. The only other differences I can find are:
I noticed some debug statements in For now I guess we're going to stick with 26.0.2 and pin hopes on an independent repro hopefully pointing to whatever this other issue is. |
Set env var |
Related note: Once we iron this issue out, I think we'll be able to promote 26.0.12 to Post-rollout, I'll also begin working on creating a new |
I've thrown together a reproduction https://github.com/Julusian/electron-builder-8970 using yarn 4.7.0 You can see my test process in the test.sh script. This results in the output: There are two electron packages here, one which has a node_modules folder and one without. They can sometimes get added due to package version conflicts, containing just the packages which conflict. |
This problem of yours should have been solved in this pull request (#8958). |
Released |
@beyondkmp yeah, I forgot to test this with the proposed fix. That reproduction does work now with 26.0.12, and my application also appears to be working (only verified on linux so far) |
Alas, we face an identical error when building our real project on Windows even after upgrading to
|
@Nantris Are you using a two package.json structure? One package.json in the app directory and another in the project directory. Using your reproduction demo with version 25.1.8 also shows issues because the package.json in the app directory is empty. Could you output the debug logs so we can take a look? |
Ah crap - I forgot that It's already crazy late here and I'm off for a couple days but I'll update ASAP. |
After upgrading to
26.0.11
it seems Sharp isn't being properly bundled or run. None of our config changed except changingwin.publisherName
towin.signToolOptions.publisherName
.I'm not sure how to go further in investigating this. Any advice appreciated!
The text was updated successfully, but these errors were encountered: