nodejs / nodejs/corepack

Versions above `v0.25.0` glitches on Node v18.17.1

Open
#400 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3.8k
Forks
279
Avg merge
1h 47m
Merged PRs (30d)
2

Description

I have this in my package.json: "packageManager": "pnpm@7.32.5".

I originally have corepack v0.22.0 (or v0.23.0 which I don't recall and doesn't matter) and it worked fine. After upgrading to v0.25.2 (then tested v0.25.0), I got this warning at first:

❯ npm i -g corepack@0.25.0
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'corepack@0.25.0',
npm WARN EBADENGINE   required: { node: '^18.17.1 | >=20.10.0' },
npm WARN EBADENGINE   current: { node: 'v18.17.1', npm: '10.4.0' }
npm WARN EBADENGINE }

changed 1 package in 689ms

❯ corepack -v
0.25.0

Then when I run my project commands:

❯ nr start:weapp
Corepack is about to download https://registry.npmjs.org/pnpm/-/pnpm-7.32.5.tgz.

Do you want to continue? [Y/n] y
Internal Error: Error when performing the request to https://registry.npmjs.org/pnpm/-/pnpm-7.32.5.tgz; for troubleshooting help, see https://github.com/nodejs/corepack#troubleshooting
    at fetch (/Users/royrao/.nvm/versions/node/v18.17.1/lib/node_modules/corepack/dist/lib/corepack.cjs:22887:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async fetchUrlStream (/Users/royrao/.nvm/versions/node/v18.17.1/lib/node_modules/corepack/dist/lib/corepack.cjs:22905:20)
    at async installVersion (/Users/royrao/.nvm/versions/node/v18.17.1/lib/node_modules/corepack/dist/lib/corepack.cjs:23075:18)
    at async Engine.ensurePackageManager (/Users/royrao/.nvm/versions/node/v18.17.1/lib/node_modules/corepack/dist/lib/corepack.cjs:23366:32)
    at async executePackageManagerRequest (/Users/royrao/.nvm/versions/node/v18.17.1/lib/node_modules/corepack/dist/lib/corepack.cjs:24222:23)
    at async BinaryCommand.validateAndExecute (/Users/royrao/.nvm/versions/node/v18.17.1/lib/node_modules/corepack/dist/lib/corepack.cjs:21164:22)
    at async _Cli.run (/Users/royrao/.nvm/versions/node/v18.17.1/lib/node_modules/corepack/dist/lib/corepack.cjs:22139:18)
    at async Object.runMain (/Users/royrao/.nvm/versions/node/v18.17.1/lib/node_modules/corepack/dist/lib/corepack.cjs:24265:12)

I had to downgrade corepack to v0.24.1 which works fine. How can I fix this? Much thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with Node v18.17.1, Corepack v0.25.0, and pnpm 7.32.5, then inspect the fetch and installVersion paths in corepack.cjs, especially Engine.ensurePackageManager. Compare the behavior with Corepack v0.24.1; done means the reported package-manager command works on the newer version and the regression is covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.