Skip to content

--no-install flag isn't working for bun x #23673

Open

Description

@lgarron

What version of Bun is running?

1.3.0

What platform is your computer?

macOS 26.0.1

What steps can reproduce the bug?

echo {} > package.json
echo '[install]' > bunfig.toml
echo 'auto = "disable"' >> bunfig.toml

bun x --no-install tsc --project .

What is the expected behavior?

bun x fails.

What do you see instead?

bun x runs a binary that is not installed for the project.

Additional information

It is important for reproducibility and security to be able to ensure that packages used by projects are pinned and loaded from the local repo. I think the --no-install is supposed to do that, but maybe I'm missing something:

> bun x --help
…
  --no-install           Skip installation if package is not already installed
…

Activity

  1. linear commented on Oct 14, 2025

    @linear
  2. lgarron commented on Oct 14, 2025

    @lgarron
    ContributorAuthor

    I found this issue because a bun x tsc invocation in one of my project build scripts was taking a bit extra to start up, and printing dependency resolution messages. (Which means this is also a perf issue.)

    I realized I forgot to declare TypeScript as a dependency, and was surprised to see the command didn't fail.

  3. added
    bun installSomething that relates to the npm-compatible client
    and removed on Oct 15, 2025
  4. lgarron commented on Dec 20, 2025

    @lgarron
    ContributorAuthor

    I wrote myself a tool to run a dependency binary in a way that enforces that it actually exists: https://github.com/lgarron/bun-dx

    I'd still like for bun x to provide that functionality, either using --no-install or perhaps using a separate command like dx. Or at least a new flag like --locked, if --no-install can't be changed.

  5. lgarron commented on Dec 20, 2025

    @lgarron
    ContributorAuthor

    Wait, it might be worse than I thought.

    Even when a dependency is pinned and installed, if that version of the dependency does not have the invoked binary, bun x will run a different version of the dependency than the pinned one. 😳

    I would consider that a security bug.

  6. added a commit that references this issue on Dec 20, 2025
  7. lgarron commented on Oct 23, 2026

    @lgarron
    ContributorAuthor

    It looks like this is now implemented when the commandline flag is passed. This is great, as at least it makes it possible to perform a safe invocation.

    However, it doesn't respect the bunfig.toml in a repo. So it still "fails unsafe" rather than having a way to "fail safe".

  8. lgarron commented on Oct 23, 2026

    @lgarron
    ContributorAuthor

    14. It looks like this is now implemented when the commandline flag is passed. This is great, as at least it makes it possible to perform a safe invocation.
    However, it doesn't respect the bunfig.toml in a repo. So it still "fails unsafe" rather than having a way to "fail safe".

    It occurs to me that perhaps others wouldn't want this as a default. Perhaps a middle ground would be something like "bun px" ("project execute") that is the same as bun x but with --no-install. This is nearly as ergonomic and much more concise than sprinkling --no-install all throughout a project (which I'm personally fine with doing, but I think would discourage people in general).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingbun installSomething that relates to the npm-compatible client

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions