Error when running 'yarn install' command in React project: 'The term 'yarn' is not recognized

38 Views Asked by At

I'm facing an issue while trying to run the 'yarn install' command in my React project. I've globally installed Yarn (npm install --global yarn), but when I attempt to execute any Yarn command in the terminal, including 'yarn install', I encounter the following error:

The term 'yarn' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify th
at the path is correct and try again.

I'd like to highlight that this project is built with React. To address this issue, I've tried the following troubleshooting steps:

Reinstalling Yarn and verifying the computer's PATH variable. Restarting both the IDE and the computer. Confirming the installation of Yarn and checking its version. Despite these efforts, I'm still encountering this error. I'm seeking assistance to understand the root cause of this issue and any potential solutions. Thank you.

1

There are 1 best solutions below

0
Gabriel On

try and run

npm install -g yarn then yarn --version

If the above version command is not running, locate yarn.ps1 and delete it, if you are under Windows it should be located here: C:\Users<username>\AppData\Roaming\npm