Installing multiple versions of PNPM in GitHub Codespaces using Docker container. But by default taking latest PNPM version.
In our GitHub Codespaces, we currently invoke a script in the onCreateCommand, which handles cloning the repository, installing PNPM version 8.8.0, and setting up the Node modules using pnpm i. I am now exploring how to manage multiple versions of PNPM by using the following set of commands in the Docker configuration:
sudo corepack enable
sudo corepack cache clean
sudo corepack prepare [email protected]
sudo corepack prepare [email protected]
sudo corepack prepare [email protected] --activate
sudo pnpm -v
However, after making the above changes in Docker, I encountered the following error. I also tried placing the logic directly in the onCreateCommand script, but that resulted in the same issue.

It always installs the latest version of PNPM, regardless of the specified version. Could someone please help me resolve this issue?