-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Issue: Sharp fails when installing with bun #4549
Comments
Sorry, yes... Adding to Should I close this issue? I am not sure. |
For now, if you are running into this issue you can add the following to your package.json. {
"trustedDependencies": [
"sharp"
]
} For sharp specifically, this won't be an issue once we merge #4263 |
0.8.2+4b63ced72dc1b304e737d9ea055c8b6e75f46119 , Darwin 22.6.0 arm64 arm I find that adding sharp to "trustedDependencies" doesn't do anything. The only way I can run this is if i |
Yes it worked after delete node_modules folder and run I will post the repo with the code. |
Great to hear! It didn't do the trick for me unfortunately, but looking forward to try your project for see if that can narrow it down somehow. |
Here you have it. https://github.com/gtrabanco/compose-images Here you can see after delete node_modules and bun.lockb that all is installed well. |
I just show you are on arm and I am at intel... Maybe any issue with arch? |
Sorry I closed the issue, was an accident 🫣 |
@gtrabanco Oh, that is an interesting observation - your repo also breaks for me. It would be interesting to hear from someone else running a macos arm64 if this example works. |
On macos/arm I need to both have sharp listed in trustedDependencies and remove the lockfile to have it install properly. |
@vfritzon Interesting, removing the bun.lockb and node_modules before running |
From the absolute ignorance about Bun internals... Strange issue 😅 I mean, would be nice know whats happening. |
For me too, with |
@alexlamsl , can you tell why trustedDependencies (introduced here #3288) are ignored if bun.lockd or node_modules already exists? |
Same issue here, the
|
Add a "trustedDependencies" property containing `sharp` (the default image processing service for Astro) because it uses custom install scripts which makes it incompatible with a normal `bun install`. For security reasons, Bun **will not** run the lifecycle scripts of installed dependencies. The "trustedDependencies" property enables developers to explicitly define an allowlist of packages that are allowed to run scripts. Steps for this workaround: - add the "trustedDependencies" property to the `package.json` - `rm -rf node_modules bun.lockb` - `bun install` See these issues and PRs: - oven-sh/bun#4549 - oven-sh/bun#2073 - oven-sh/bun#3746
In monorepo (ex-yarn workspaces), the UPD: It actually does a weird thing. When bun is used in combo with |
|
@kanashimia I faced the same problem when using the bun docker image as base. I changed to
as a workaround. My guess is that is due to the sharp install script which uses node: |
Have you tried with |
My workaround is to manually bun install "postinstall": "cd node_modules/sharp && bun install && cd ../.. && cd node_modules/sqlite3 && bun install && cd ../.." |
@mquandalle i don't think it's related to the OS. even on my own pc (Linux Mint) that generated the lockfile it's doesn't run postinstall scripts |
does just deleting this stuff work? oven-sh/bun#4549
@birkskyum I get
|
Hey @Electroid I experienced the same issue with astro starlight having issues with installing sharp.
So maybe it's just an installing issue |
facing the same issue if i use yarn it get solved but with bun it gives me error
|
#4263 is closed due to #5077 Remarksconfirmed not required if |
You will be unable to reproduce this issue with latest sharp version because the need of running postinstall script was deleted in |
Since sharp has a good solution now, this can be closed in favor of the more general issues on this topic: |
hey sorry for the question but I didn't really understand what the solution to this problem is. I added sharp 0.33.1 to the trustedDependencies but it still doesn't work for me when I try to deploy my astro starlight to gitlab pages |
What error do you have? Which version of Bun are you using? |
Thanks for the help but I already solved it the image i was using in my pipeline bun:alpine had the wrong version changed to bun:latest everything works fine now. |
Sharp only works server side, and GitHub/gitlab pages are statically side generated, so only client side. could that be the issue here? |
This comment was marked as resolved.
This comment was marked as resolved.
I seem to be running into this issue too. I have the following package.json {
"name": "bun-sharp-test",
"module": "index.mjs",
"type": "module",
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"trustedDependencies": [
"sharp"
],
"dependencies": {
"sharp": "^0.33.4"
}
} After running
Versions:
|
Just battled with the issue for the last few days when trying to create a Dockerfile for Nuxt. Switched my docker build from |
You need to go to node_modules/sharp and then just do bun install again. |
I have the same, not sure how to fix it.
"resolutions": {
"sharp": "0.33.5"
},
|
Why was this issue closed please? Bun seems to be having some arbitrary issues with sharp. |
It still doesn't work for me, unsure why this was closed.. |
because other root cause was fixed. afaik it was due postinstall script |
Same issue with Deno:
|
I had to do Alternatively you can |
just wonder after 2 years this issue still exist🤯 |
@caturbgs, no it doesn't. It's closed. Please share more details about the issue. If this is a new problem, you might want to open a new issue instead of commenting on a closed one. |
@caturbgs please open a new issue and paste the errors and the logs for what you're running into this issue has been fixed for some time. Usually, the reason this could still come up is if a postinstall script is trying to run a C/C++ compiler and the machine or docker image doesn't have one installed or configured properly (you may need to run |
What version of Bun is running?
1.0.0+5b9d8b87c41410091a7c602b895ad9ffda17819c
What platform is your computer?
Darwin 21.6.0 x86_64 i386
What steps can reproduce the bug?
Install Sharp
Code
What is the expected behavior?
Output next content:
What do you see instead?
Additional information
Workaround
When using npm to install de dependencies it does not fail even while running with bun. Possible there is any missing feature in
bun install
?I haven't tried with previous versions of Bun.
The text was updated successfully, but these errors were encountered: