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

Make binary intsallation behavior more sensible #6928

Closed
cometkim opened this issue Nov 6, 2023 · 3 comments · Fixed by #12506
Closed

Make binary intsallation behavior more sensible #6928

cometkim opened this issue Nov 6, 2023 · 3 comments · Fixed by #12506
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client

Comments

@cometkim
Copy link

cometkim commented Nov 6, 2023

What version of Bun is running?

1.0.9

What platform is your computer?

Linux 6.2.0-36-generic x86_64 x86_64

What steps can reproduce the bug?

bun add vite

# expect this to be failed
bun esbuild --version

bun remove vite

# expect this to be failed
bun esbuild --version

Do same test for global

What is the expected behavior?

Vite package has the vite binary in its manifest, and 3 other binaries esbuild, rollup, nanoid from its transitive dependencies.

Users expect only vite command available after installation, especially when it is for global installation.

What do you see instead?

Bun installs all binaries from transitive dependencies. So vite, esbuild, rollup, nanoid commands are available.

And even Bun doesn't cleanup transitive binaries after uninstalling vite, so even after uninstallation esbuild, rollup, nanoid commands are available. The only option for cleanup is to remove and regenerate node_modules, and this is not possible for global installation.

Additional information

https://gist.github.com/cometkim/eb2842d67b40e583e4886e9b897a6af0

@cometkim cometkim added the bug Something isn't working label Nov 6, 2023
@Electroid Electroid added the bun install Something that relates to the npm-compatible client label Nov 6, 2023
@Electroid
Copy link
Contributor

So this does match the behaviour of npm and yarn, but I can see the argument to not do this.

Also, this is seperate bug:

Bun doesn't cleanup transitive binaries after uninstalling

@cometkim
Copy link
Author

cometkim commented Nov 7, 2023

So this does match the behaviour of npm and yarn, but I can see the argument to not do this.

no. yarn and pnpm don't allow execution of binaries from transitive dependencies. Only vite is available when installing Vite.

@cometkim
Copy link
Author

cometkim commented Nov 7, 2023

Yarn and PNPM are intentionally incompatible with NPM's bad behaviors around transitive dependencies

  • It is non-deterministic. When transitive dependencies B and C declare the same bin: foo, which should be resolved?
  • It causes unintended installation by the user. So it could be vulnerable to supply chain attacks.
  • It bloats shell completions. Users will see a list of bins that have never installed.

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.

2 participants