yarn@berry and yarn@latest install yarn 1.x, not yarn 4.x.
@yarnpkg/cli is the actual yarn 4.x npm package. Also restore
yarn 1.x before 'yarn set version stable' on METHOD 4.
Global /root/.yarn cache contains stale builtin<compat/typescript>
patch references to _tsc.js that don't exist in typescript 7.0.2.
Clean it before each yarn install attempt.
PnP files (.pnp.cjs, .pnp.d.ts, .pnp.loader.mjs) can cause stale
typescript patch resolution errors (ENOENT _tsc.js). Clean them
before yarn install and before retry.