nodejs / corepack

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

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

Open RoyRao2333 opened 4 months ago

RoyRao2333 commented 4 months ago

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!

aduh95 commented 4 months ago

Can you confirm what's the behavior of v0.25.2?

hubofgitongithub commented 4 months ago

@aduh95 I can confirm this still happens with v0.25.2. We try to install yarn through corepack and also run into:

Internal Error: Error when performing the request to https://registry.npmjs.org/yarn; for troubleshooting help, see https://github.com/nodejs/corepack#troubleshooting
RoyRao2333 commented 4 months ago

Thanks @hubofgitongithub for confirmation.

@aduh95 Yes. As I described above, I installed v0.25.2 at first which is problematic, so I went on trying v0.25.0 and still no luck.

So both of them should have this issue.

RoyRao2333 commented 3 months ago
image

Still a problem in node v18.19.1

RoyRao2333 commented 1 month ago

Encounter this after upgrading to corepack@0.28.2:

https://github.com/pnpm/pnpm/issues/7724