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 ignores trustedDependencies when bun.lockb is present #5472

Closed
controversial opened this issue Sep 15, 2023 · 1 comment · Fixed by #6376
Closed

bun install ignores trustedDependencies when bun.lockb is present #5472

controversial opened this issue Sep 15, 2023 · 1 comment · Fixed by #6376
Labels
bug Something isn't working bun install Something that relates to the npm-compatible client

Comments

@controversial
Copy link
Contributor

controversial commented Sep 15, 2023

What version of Bun is running?

1.0.1+92e95c86dd100f167fb4cf8da1db202b5211d2c1

What platform is your computer?

Darwin 23.0.0 arm64 arm

What steps can reproduce the bug?

  1. Create the following package.json:

    {
      "dependencies": {
        "@prisma/client": "^5.3.1"
      },
      "trustedDependencies": ["@prisma/client"]
    }

    note @prisma/client is just an arbitrary package with a postinstall script; you can replace with any other package that runs a postinstall.

  2. bun install

    Observe that bun.lockb and node_modules are created.
    Observe also that the postinstall script runs (see output like prisma:warn The postinstall script ...; the warning is expected in the absence of a schema.prisma file)

  3. rm -rf node_modules && bun install

    Observe that the postinstall script for @prisma/client does not run—there is no visible output in the terminal on a “second install” once bun.lockb is present.

  4. rm -rf node_modules bun.lockb && bun install

    Observe that when neither node_modules nor bun.lockb is present, the postinstall script once again runs for trustedDependencies

What is the expected behavior?

Install scripts for trustedDependencies should run for subsequent installs even once bun.lockb is present.

What do you see instead?

Install scripts for trustedDependencies only run on the first install (before bun.lockb is created).
When a new user clones a repository and runs bun install, install scripts do not run, since bun.lockb is committed but node_modules is not.

Additional information

Some discussion of this bug in the comments following #4549 (comment)

Opening a separate issue as #4549 was originally about a slightly different issue (ie the need to add packages like sharp to trustedDependencies)

@controversial controversial added the bug Something isn't working label Sep 15, 2023
@controversial controversial changed the title “Bun install” ignores some trustedDependencies when bun.lockb is present “Bun install” ignores trustedDependencies when bun.lockb is present Sep 15, 2023
@fatihdogmus
Copy link

I have the exact same problem.

@Electroid Electroid added the bun install Something that relates to the npm-compatible client label Sep 15, 2023
@controversial controversial changed the title “Bun install” ignores trustedDependencies when bun.lockb is present bun install ignores trustedDependencies when bun.lockb is present Sep 15, 2023
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.

3 participants