4

I installed yarn using npm: npm i -g yarn

when I execute the command yarn -v or any other yarn command on cmd or PowerShell it Outputs the Version

But on GitBash it displays: C:\Users\<my_username>\AppData\Roaming\npm/node_modules/node/bin/node: line 1: This: command not found

I even tried Reinstalling Node & Yarn but it still doesn't work.

1 solution I found is that instead of yarn if I use yarn.cmd then it works in GitBash.

But I'm unable to find the reason & the correct solution for this problem. If someone has any Idea please Guide me.

1 Answer 1

3

I tried so many things and in the end I'm not sure which really worked. Maybe you find out that another step works in your case.

So here's some of the sensible things I did:

  1. I reinstalled node, yarn and git because that's the default behavior of a man in confusion. (Didn't work)
  2. Tried manipulating PATH although yarn was recognized from cmd and powershell. (Didn't work)
  3. I found this: https://yarnpkg.com/getting-started/install. It seems like they updated the installation steps. So I tried that because it was something different from the yarn installation you and I used... It worked!

Now, if the last step was the one that worked, make sure to run npm uninstall -g yarn after

Sign up to request clarification or add additional context in comments.

1 Comment

Thank You Very Much for the help, Following the new corepack approach Worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.