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"'
}
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.
I'm using this with Jenkins on AWS.
However, the last step (corepack prepare yarn@3.4.1 --activate) fails producing the following error message:
I ran the command individually, so I can confirm that it is the last one that produces the error.
Please, help.