corepack icon indicating copy to clipboard operation
corepack copied to clipboard

Internal Error when Installing [email protected] in the project...

Open xmasuhai opened this issue 7 months ago • 5 comments

Link to the code that reproduces this issue or a replay of the bug https://github.com/xmasuhai/test-vite

Reproduction steps

cd test-vite
corepack use pnpm@latest-10

Describe the Bug

$ corepack use pnpm@latest
Internal Error: Server answered with HTTP 404 when performing the request to https://registry.npmmirror.com//pnpm; for troubleshooting help, see https://github.com/nodejs/corepack#troubleshooting
    at fetch (D:\software\nvm\v22.15.0\node_modules\corepack\dist\lib\corepack.cjs:22058:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async fetchAsJson (D:\software\nvm\v22.15.0\node_modules\corepack\dist\lib\corepack.cjs:22065:20)
    at async fetchAvailableTags (D:\software\nvm\v22.15.0\node_modules\corepack\dist\lib\corepack.cjs:22005:20)
    at async fetchAvailableTags2 (D:\software\nvm\v22.15.0\node_modules\corepack\dist\lib\corepack.cjs:22128:14)
    at async Engine.resolveDescriptor (D:\software\nvm\v22.15.0\node_modules\corepack\dist\lib\corepack.cjs:22981:20)
    at async UseCommand.execute (D:\software\nvm\v22.15.0\node_modules\corepack\dist\lib\corepack.cjs:23457:22)
    at async UseCommand.validateAndExecute (D:\software\nvm\v22.15.0\node_modules\corepack\dist\lib\corepack.cjs:20258:22)
    at async _Cli.run (D:\software\nvm\v22.15.0\node_modules\corepack\dist\lib\corepack.cjs:21195:18)
    at async Object.runMain (D:\software\nvm\v22.15.0\node_modules\corepack\dist\lib\corepack.cjs:23642:19)

Which Node.js version are you using? 22.15.0

Which operating systems have you used win11

xmasuhai avatar May 10 '25 14:05 xmasuhai

@xmasuhai

It looks like you have the environment variable COREPACK_NPM_REGISTRY set to https://registry.npmmirror.com/. Is that correct?

If yes, have you tried setting it to https://registry.npmmirror.com instead (without the trailing / character).

MikeMcC399 avatar May 11 '25 18:05 MikeMcC399

It looks like there are 2 issues involved:

  1. The Chinese npm mirror https://registry.npmmirror.com/ rejects the URL https://registry.npmmirror.com//pnpm whereas the official npm registry https://registry.npmjs.org accepts the URL https://registry.npmjs.org//pnpm and Corepack is then able to install:

Installing [email protected] from https://registry.npmjs.org//pnpm/-/pnpm-10.10.0.tgz

  1. Corepack should not be building the URL with a double slash //. It should strip it down to https://registry.npmmirror.com/pnpm instead. See https://github.com/nodejs/corepack/issues/711

MikeMcC399 avatar May 12 '25 10:05 MikeMcC399

Relates also to https://github.com/nodejs/corepack/issues/535, https://github.com/nodejs/corepack/issues/540 and https://github.com/nodejs/corepack/issues/458

MikeMcC399 avatar May 12 '25 10:05 MikeMcC399

@xmasuhai

If your problem is resolved, you can close this issue with the button below.

MikeMcC399 avatar May 15 '25 05:05 MikeMcC399

Since there hasn't been any response, I suggest to close this issue.

MikeMcC399 avatar May 19 '25 14:05 MikeMcC399