Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use COREPACK_NPM_REGISTRY but throw Internal Error: Server answered with HTTP 301 when performing the request #336

Closed
wind4gis opened this issue Dec 11, 2023 · 3 comments · Fixed by #341

Comments

@wind4gis
Copy link

I run COREPACK_NPM_REGISTRY=https://registry.npm.taobao.org corepack prepare pnpm@latest-8 --activate
but it throw the error Internal Error: Server answered with HTTP 301 when performing the request to https://registry.npm.taobao.org/pnpm; for troubleshooting help, see https://github.com/nodejs/corepack#troubleshooting

@guibwl
Copy link
Contributor

guibwl commented Dec 13, 2023

Taobao registry will redirect and return with 302;

image

It will cause corepack error;

 [exec] Internal Error: Server answered with HTTP 302

     [exec]     at ClientRequest.<anonymous> (/home/ndp-soft/node-v16.20.1-linux-x64/lib/node_modules/corepack/dist/corepack.js:43949:23)

     [exec]     at Object.onceWrapper (node:events:628:26)

     [exec]     at ClientRequest.emit (node:events:513:28)

     [exec]     at HTTPParser.parserOnIncomingClient (node:_http_client:693:27)

     [exec]     at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)

     [exec]     at TLSSocket.socketOnData (node:_http_client:534:22)

     [exec]     at TLSSocket.emit (node:events:513:28)

     [exec]     at addChunk (node:internal/streams/readable:315:12)

     [exec]     at readableAddChunk (node:internal/streams/readable:289:9)

     [exec]     at TLSSocket.Readable.push (node:internal/streams/readable:228:10)

Source code in here:
https://github.com/nodejs/corepack/blob/b7aa57644c490f8700834721ab0a70d093264b22/sources/httpUtils.ts#L18C68-L18C68
image

I think return 302 should be allowed? Can anyone change this logic? or PR?

@arcanis
Copy link
Contributor

arcanis commented Dec 13, 2023

Corepack doesn't support redirections. We welcome PRs.

@guibwl
Copy link
Contributor

guibwl commented Dec 14, 2023

Corepack doesn't support redirections. We welcome PRs.

hi, I made a PR for support redirections.
#341

@aduh95 aduh95 linked a pull request Dec 29, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants