Skip to content

Internal Error: Server answered with HTTP 403: hardcoded registries? #66

@lmmarsano

Description

@lmmarsano

Getting a 403 error

$ nodenv global 17.1.0
$ npm ls -g --depth 0
/home/LOM0227/stow/nodenv/.nodenv/versions/17.1.0/lib
├── corepack@0.10.0
└── npm@8.1.2

$ corepack enable
$ pnpm
Internal Error: Server answered with HTTP 403
    at ClientRequest.<anonymous> (/home/LOM0227/stow/nodenv/.nodenv/versions/17.1.0/lib/node_modules/corepack/dist/corepack.js:3933:31)
    at Object.onceWrapper (node:events:510:26)
    at ClientRequest.emit (node:events:390:28)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:623:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
    at TLSSocket.socketOnData (node:_http_client:487:22)
    at TLSSocket.emit (node:events:390:28)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at TLSSocket.Readable.push (node:internal/streams/readable:234:10)

I suspect these hardcoded registries have something to do with that.

const data = await httpUtils.fetchAsJson(`https://registry.npmjs.org/${spec.package}`, {headers: {[`Accept`]: `application/vnd.npm.install-v1+json`}});

const data = await httpUtils.fetchAsJson(`https://registry.npmjs.org/${spec.package}`, {headers: {[`Accept`]: `application/vnd.npm.install-v1+json`}});

This doesn't work for environments that block the public registry and require a private registry like artifactory, eg,

$ npm config list
; "user" config from /home/LOM0227/.npmrc

//[redacted].jfrog.io/artifactory/api/npm/emf-npm-virtual/:_password = (protected) 
//[redacted].jfrog.io/artifactory/api/npm/emf-npm-virtual/:username = "lmarsano@[redacted].com" 
always-auth = true 
email = "LMarsano@[redacted].com" 
registry = "https://[redacted].jfrog.io/artifactory/api/npm/emf-npm-virtual/" 

Maybe lookup registry from config files?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions