Corepack error with yarn in local environment

Hello … I am trying to setup and run locally the Hello World exercise for the TypeScript Track. I went through all the steps & installed everything needed as per Installing TypeScript locally | Exercism's Docs
I am on MacOS:
% exercism debug

Troubleshooting Information


Current: 3.2.0
Latest: 3.2.0

Operating System

OS: darwin
Architecture: amd64

hello-world % npm -v
hello-world % node -v
hello-world % yarn -v

When I am trying to execute
$ yarn test

I get the following error:
% yarn test

Internal Error: Your application tried to access corepack, but it isn’t declared in your dependencies; this makes the require call ambiguous and unsound.

Required package: corepack (via “corepack/package.json”)

Any suggestions on how to resolve the issue?

There’s a few duplicate posts in the forum on this. I believe upgrading yarn to the latest version (or maybe node) fixes it. If you search the forum for yarn you should come across them :slight_smile:

Thanks for your help on this. I was able to resolve this error by adding corepack as a dependency:

% yarn add -D corepack

But now I am running into another issue:

% yarn test
Type Error: Cannot read properties of undefined (reading ‘/Users/myuser/Exercism/typescript/hello-world/.pnp.cjs’)
at c4 (/Users/myuser/Exercism/typescript/hello-world/.yarn/releases/yarn-3.6.0.cjs:390:12692)
at a0e (/Users/myuser/Exercism/typescript/hello-world/.yarn/releases/yarn-3.6.0.cjs:390:13173)
at (/Users/myuser/Exercism/typescript/hello-world/.yarn/releases/yarn-3.6.0.cjs:390:13402)
at /Users/myuser/Exercism/typescript/hello-world/.yarn/releases/yarn-3.6.0.cjs:694:4611
at Object.Ta (/Users/myuser/Exercism/typescript/hello-world/.yarn/releases/yarn-3.6.0.cjs:390:10714)
at wl.findPackageLocation (/Users/myuser/Exercism/typescript/hello-world/.yarn/releases/yarn-3.6.0.cjs:694:4566)
at /Users/myuser/Exercism/typescript/hello-world/.yarn/releases/yarn-3.6.0.cjs:423:1264
at Function.from ()
at LB (/Users/myuser/Exercism/typescript/hello-world/.yarn/releases/yarn-3.6.0.cjs:423:1008)
at d9 (/Users/myuser/Exercism/typescript/hello-world/.yarn/releases/yarn-3.6.0.cjs:423:1589)

I see another post on this but I am already on the latest version of node(v10.2.3)/npm(v21.1.0)/yarn (v3.6.0) so the suggested solution does not work for me.

Any ideas on how to resolve this?