nodejs / corepack

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

"corepack prepare yarn@3.4.1 --activate" results in "Internal Error: Server answered with HTTP 503" #286

Open crs1138 opened 1 year ago

crs1138 commented 1 year ago

I'm using this with Jenkins on AWS.

  1. I set up Node to the version (v16.15.1) set in .nvmrc file:
    if (fileExists('.nvmrc')) {
    sh 'bash -l -c "(((nvm install > /dev/null) && nvm use) && nvm alias default node) || true"'
    }
  2. Then check if corepack is available and if not install it; then enable corepack and try to install yarn@3.4.1 (the same version is specified in package.json as the "packageManager": "yarn@3.4.1" property
    sh "bash -l -c '(corepack --version || npm i -g corepack) && corepack enable && corepack prepare yarn@3.4.1 --activate'"

    However, the last step (corepack prepare yarn@3.4.1 --activate) fails producing the following error message:

    16:14:42  Internal Error: Server answered with HTTP 503
    16:14:42      at ClientRequest.<anonymous> (/usr/local/nvm/versions/node/v16.15.1/lib/node_modules/corepack/dist/corepack.js:3933:31)
    16:14:42      at Object.onceWrapper (node:events:642:26)
    16:14:42      at ClientRequest.emit (node:events:527:28)
    16:14:42      at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:631:27)
    16:14:42      at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
    16:14:42      at TLSSocket.socketOnData (node:_http_client:494:22)
    16:14:42      at TLSSocket.emit (node:events:527:28)
    16:14:42      at addChunk (node:internal/streams/readable:315:12)
    16:14:42      at readableAddChunk (node:internal/streams/readable:289:9)
    16:14:42      at TLSSocket.Readable.push (node:internal/streams/readable:228:10)

    I ran the command individually, so I can confirm that it is the last one that produces the error.

Please, help.

jdelucaa commented 1 year ago

Getting the same error here, any help? It fails on the same command: corepack prepare yarn@stable --activate on node:19.6