nodejs / corepack

Zero-runtime-dependency package acting as bridge between Node projects and their package managers
MIT License
2.31k stars 145 forks source link

`prepare` script blocks correct usage #480

Closed hesxenon closed 1 month ago

hesxenon commented 1 month ago

Hello there,

I'm not sure whether I've just missed an existing issue in which case I am deeply sorry - but the issue is as follows:

  1. clone any project that...
    • has corepack configured to a higher version than your current PM
    • has a prepare script that utilizes a binary from node_modules/.bin
    • uses engines strict (?)
  2. try to install dependencies - fails, wrong PM version
  3. try to upgrade PM - fails, because prepare script is run without binary

It's worth noting that corepack downloads the correct PM, but apparently fails to "activate" it due to the prepare script exiting with non-zero.

E.g.:

  1. setup husky
  2. run corepack use <PM>
  3. git clean or similar
  4. try to switch to any other PM
  5. deadlock
aduh95 commented 1 month ago

Thanks for sending this! I'm not sure I understand the issue, and the repro steps you provided are a bit too vague. Could you send a list of commands I could run to see the issue on my machine?

hesxenon commented 1 month ago

hmmmm, upon trying to create such a list of steps I noticed that I was unable to reproduce the issue. I think the original problem happened due to either a misusage of corepack (use vs. install) and/or a bit of a nvm/pnpm managed node version conflict on my machine.

Closing for now but I don't think this will re-occur, sorry to bother you