-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
How does asaar work in Electron for Sharp? #3985
Comments
The default settings in Electron builder results in
There's not enough information here to help, sorry, and My current advice to anyone working on multi or cross platform Node.js apps is to use either yarn 3+ or pnpm to manage dependencies via the |
Yeah @lovell you're spot on that Regarding using pnpm/yarn 3+ for multi/cross platform Node apps with the |
@damms005 Were you able to make any progress with this? |
Still working on it. Will definitely update this issue ASAP |
Now I think I made some progress, @lovell After some days in the rabbit hole, I was able to piece together something that may help improve the cross-platform support of Sharp, and hopefully fix the compilation issue I am having. First, this is my test env:
Like I mentioned above, the issue I have is with an Electron app. This Electron app is built with Quasar. When I build the project, I noticed this portion of the output:
From this output, I was led to believe that To be sure this is not some randomly occurring issue, I then created a new project, looked for some other random native package, included sharp and sqlite3, so that I have 3 native packages in the project. Interestingly, the 2 other dependencies were built, but
Now, this is where I need your help. I do not have the expertise to debug why I ensured that the README is descriptive enough to allow you reproduce it locally. Furthermore, I configured GitHub Actions and ensured an action reproduces the issue, to ensure it is not some local issue with my setup. I hope this provides a little bit more of info to help figure this out. Please let me know if you have any questions or need any more details. Thank you. |
And yes, I don't have a lot of options with yarn neither. That's why I've got to go through all the troubles of the efforts I made with my previous comment with the repro repo. |
Thanks for the updates, I can't find where you've added the https://github.com/search?q=repo%3Adamms005%2Fsharpie%20asarUnpack&type=code It might be worth asking the quasar maintainers again about yarn support, as the last update was 2 years ago, and in that time yarn v1 has bit-rotted by another 2 years. (An open source library that continues to dogmatically recommend yarn v1 over all other package managers has, rather sadly, become a red flag for me.) |
Yeah, you're correct about the red flag. It is now much so in retrospect, but not much so few years ago when I opted to use quasar for the project. Stuck in this hole, sadly. Also, this should have been a different issue at this stage, because the progress of this thread has steered off the original Unfortunately, the quasar team don't have builder improvements on their roadmap at the moment. I mean it is even Yarn v4+ already and they are still insisting on v1. Perhaps I should look for help with the maintainers of the builder package itself at However, if you can find some time later to look into this, I can create a new issue/discussion titled something like "Appeal for improved cross-platform support" or similar, and move this there. But I appreciate the time you have given to this thread already and if you are not willing to look into why/how those two other packages are able to work nicely with |
It just dawned on me that I tried every single other fix going down that rabbit hole except the very instruction about asarUnpack It now works. Thank you. However, please how does this asarUnpack option work, compared to the rebuilding approach? I now understand, buy this rabbit hole, that rebuilding essentially builds the package from source based on the current OS and arch. This ensures that the bundles Electron app's node_modules folder contains the necessary binaries for the native package. Can you spare some sweat and explain how this asarUnpack option works to complement this understanding of mine, please? PS: This sounds noob and stupid, but I don't know if it has any bearing on getting sharp to build natively with electron-builder: the other packages have their |
Just thought to add that scanning seems to be done one-level deep? as mentioned in this electron-builder comment. The point I made above with nesting |
As of v0.33.0, sharp no longer includes a Given almost all platforms are fully-supported with prebuilt binaries, Lines 143 to 163 in 02fd565
The npm registry contains this data, which is used by package managers such as npm, yarn and pnpm to install the relevant package(s).
This approach is becoming more prevalent (see also parcel, esbuild, swc etc.) and I suspect |
That's a 💯 Thanks a lot, @lovell |
Question about an existing feature
What are you trying to achieve?
I want to understand why the installation docs still have:
Meanwhile, the linked Electron doc has:
Context:
I have an Electron app that I want to implement Sharp for, but whenever I package it for production and I use Sharp, the API exposed via contextBridge is not available in the renderer process.
When you searched for similar issues, what did you find that might be related?
I think that section of the Sharp docs need to be removed or updated to prevent confusion for rookies like me
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this question
N/A
Please provide sample image(s) that help explain this question
N/A
PS: @lovell can you help or provide paid consultation to teach me how cross-platform deployments work in node? I think I am having an issue related to this in my OSS project and it is saddening that I do not have any clue on how to approach solving it 😞
The text was updated successfully, but these errors were encountered: