Skip to content
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

bun install should not run the prepare script of trusted dependencies #5017

Closed
ohana54 opened this issue Sep 11, 2023 · 5 comments · Fixed by #7132
Closed

bun install should not run the prepare script of trusted dependencies #5017

ohana54 opened this issue Sep 11, 2023 · 5 comments · Fixed by #7132
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client

Comments

@ohana54
Copy link

ohana54 commented Sep 11, 2023

What version of Bun is running?

1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983

What platform is your computer?

Darwin 21.6.0 x86_64 i386

What steps can reproduce the bug?

Hi,

I encountered an issue with installing @swc/core as a trusted dependency.
Bun tries to run its prepare script, which fails.

AFAIK, per the npm docs and the behavior of npm/yarn, the prepare script should not be run when installing a dependency.
It is intended to be a script for the local dev of that package.

What is the expected behavior?

bun install should not run prepare scripts of trusted dependencies.

What do you see instead?

example failure when installing @swc/core:

bun install v1.0.0 (822a00c4)
 + @swc/[email protected]
/bin/bash: husky: command not found

 3 packages installed [30.00ms]
error: script "prepare" exited with code 127

Additional information

No response

@ohana54 ohana54 added the bug Something isn't working label Sep 11, 2023
@Jarred-Sumner
Copy link
Collaborator

definitely a bug

@nagolyhprum
Copy link

This might not be the solution you are looking for but you can skip life cycle events using --ignore-scripts. I believe this is the line doing it: https://github.com/oven-sh/bun/blob/main/src/install/install.zig#L7955C37-L7955C37.

@ohana54
Copy link
Author

ohana54 commented Sep 14, 2023

Thanks, although I actually need to run the postinstall of @swc/core.

@kyleosborn
Copy link

This one is a blocker for us also. We've had issues with swc-loader and bun.sh - I just discovered the trusted-deps however since putting a few in here it's caused a whole host of other problems.

@martinmckenna
Copy link

yep having this exact issue when converting over my Dockerfile to use bun. This should definitely match what npm and yarn do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants