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

postinstall scripts in monorepos aren't run if there's errors with the installation #4447

Open
Hebilicious opened this issue Sep 1, 2023 · 4 comments
Labels
bug Something isn't working npm Something that relates to the npm-compatible client

Comments

@Hebilicious
Copy link

Hebilicious commented Sep 1, 2023

What version of Bun is running?

v0.8.1

What platform is your computer?

Cloudflare pages v2 (I haven't been able to reproduce the bug locally)

What steps can reproduce the bug?

In a monorepo with the following structure :

  • packages/foo/package.json
  • package.json

The postinstall script in foo/package.json script doesn't run when running bun i.
I tried with { "trustedDependencies": ["foo"] } in the root package.json without success.

I suspect the reason is that I'm getting this error while installing dependencies. This error doesn't seem very important and I'm able to manually run the postinstall scripts later.

00:16:26.655 | 1618 packages installed [16.94s]
-- | --
00:16:26.655 | Failed to install 2 packages
00:16:26.656 | error: PathAlreadyExists installing strip-ansi
00:16:26.656 | error: PathAlreadyExists installing string-width

What is the expected behavior?

I would expect the postinstall scripts to run (They run locally on my machine Darwin 22.6.0 arm64 arm)
Additionally if the error is not critical, maybe the postinstall scripts should run before the error, and we could have a way to ignore/silence it or it should be a warning instead?

What do you see instead?

00:16:26.655 | 1618 packages installed [16.94s]
-- | --
00:16:26.655 | Failed to install 2 packages
00:16:26.656 | error: PathAlreadyExists installing strip-ansi
00:16:26.656 | error: PathAlreadyExists installing string-width

Additional information

No response

@Hebilicious Hebilicious added the bug Something isn't working label Sep 1, 2023
@Hebilicious Hebilicious changed the title postinstall scripts in monorepos aren't run if there's an error with the installation postinstall scripts in monorepos aren't run if there's errors with the installation Sep 1, 2023
@zfben
Copy link

zfben commented Sep 3, 2023

I have the same issue.

@brpowell
Copy link

I'm also having this issue in Github Actions, but not locally (Apple Silicon). My workaround is this at the moment:

- uses: oven-sh/setup-bun@v1

- name: Install dependencies
   run: bun install --frozen-lockfile && bun run postinstall

@coffeeispower
Copy link
Contributor

I got this issue with this repo: https://github.com/SaphireBot/Bot

Please fix this!

@raulfdm
Copy link

raulfdm commented Sep 12, 2023

not only post install but any hook. My repo is a monorepo that defines the prepare script for the packages to be built and those don't run after the error.

@Electroid Electroid added the npm Something that relates to the npm-compatible client label Oct 27, 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 npm Something that relates to the npm-compatible client
Projects
None yet
Development

No branches or pull requests

6 participants