Drop the corepack package manager strict check when invoked by another process
Tracking Option 2 proposed by @nathanhammond from https://github.com/nodejs/corepack/issues/195#issuecomment-1288368183 as a separate issue since that issue has been closed
- Drop the corepack check when invoked by another process
As per 0.15.0, Option 3 has been implemented:
- Push the solution to consumers via
COREPACK_ENABLE_STRICT=0 <whatever> install
but I guess we can still pursue Option 2 so that Corepack adoption and developer experience would be better
I'm still against dropping the check in any kind of "by default" behaviour. Using the wrong package manager for the currently installed project is broken and should be fixed upstream. Corepack is the wrong layer for that.
I have no horse in this race. Out of context this proposal feels a lot stronger than I ever intended for it to be. It was originally presented as just one option along a spectrum of correctness versus pragmatism.
It may still be worth considering, but it's entirely reasonable to delay implementation.
Using the wrong package manager for the currently installed project is broken and should be fixed upstream
@arcanis I don't know how this can be fixed upstream.
For example, today I tried to install @replayio/playwright using pnpm.
pnpm install
Scope: all 25 workspace projects
Lockfile is up to date, resolution step is skipped
Packages: +108 -10
Progress: resolved 108, reused 108, downloaded 0, added 0, done
node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@replayio/playwright: Running install script, failed in 81ms
.../node_modules/@replayio/playwright install$ npm run if:dist -- node ./bin/replayio-playwright first-run
│ Usage Error: This project is configured to use pnpm
│ $ npm ...
└─ Failed in 81ms at /node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@replayio/playwright
ELIFECYCLE Command failed with exit code 1.
What should @replayio/playwright use instead here that would support every package manager?
https://github.com/replayio/replay-cli/blob/025420d7528f34fcb95562eda195076fa04fdda0/packages/cypress/package.json#L11C1-L11C1
I think https://github.com/nodejs/corepack/issues/57 could solve this but it looks like it was rejected.
In theory, $npm_execpath run instead of npm run. Which gets tricky with Windows, so the easiest and most portable option is usually to make the install script a .js file ...
Yarn 2+ supports dropping the $npm_execpath and only use run, but no other package manager does. Would be nice if this could be standardized across the board.