Hi All! I am trying to deploy backstage application with jenkins however, I am running into corepack related errors. This is working locally but fails when I am using image 'node:20-bullseye' and running the below script
container('node') {
sh '''
ls -l $(which yarn)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \\. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \\. "$NVM_DIR/bash_completion"
corepack enable
corepack -v
corepack prepare [email protected] --activate
yarn set version 4.4.1
yarn -v //just checking version
'''
sh 'yarn install --immutable'
sh 'yarn tsc'```
This is the error I am running into -
```+ yarn install --immutable
15:25:00 error This project's package.json defines "packageManager": "[email protected]". However the current global version of Yarn is 1.22.22.
15:25:00
15:25:00 Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19.
15:25:00 Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.```