11

Environment: Windows, Node 16.18.0, Corepack 0.14.1

I am following these instructions to install Yarn.

When I run corepack prepare yarn@3.2.4 or corepack prepare yarn@3.2.4 --activate

I get the following error:

Preparing yarn@3.2.4... Internal Error: ENOENT: no such file or directory, stat 'C:\Users\rashiditaba\AppData\Local\node\corepack\yarn\3.2.4' Error: ENOENT: no such file or directory, stat 'C:\Users\***\AppData\Local\node\corepack\yarn\3.2.4'
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
aryan
  • 130
  • 1
  • 8

3 Answers3

19

Hello I experienced the same problem. Corepack is an experimental tool to help with managing versions of your package managers. Due to its experimental status, Corepack currently needs to be explicitly enabled to have any effect.

Disable Corepack with the command:

corepack disable

You will now be able to install yarn via npm:

npm install -g yarn --force

To check the installed version of yarn use:

yarn -v

To upgrade the version use (stable version 3.2.4):

yarn set version stable

Now you can enable corepack again (if it fails keep it disabled):

corepack enable

Try the failed command:

corepack prepare yarn@3.2.4 --activate

I leave you the link with the description of the solution: https://nodejs.org/dist/latest/docs/api/corepack.html

I hope it helps you

1

From the error your getting it seems like you have to wrong directory PATH to yarn. Find the directory where yarn is installed and update it's PATH in the environment variables.

BeeFriedman
  • 1,800
  • 1
  • 11
  • 29
0

I had the same issue. There seems to be a problem which prevents corepack from downloading the latest yarn.js script file.

My solution:

  • run corepack enable as described in the install guide
  • create the folder AppData\Local\node\corepack\yarn\3.4.1
  • download https://repo.yarnpkg.com/3.4.1/packages/yarnpkg-cli/bin/yarn.js and place the file in the folder you just created
  • run corepack prepare yarn@stable --activate

and you should be good to go:

> yarn -v
3.4.1
Daemotron
  • 11
  • 3