VSCode not recognizing my command

Hello! I’m learning about testing with jest. I created a React App, cd-ed into my-app and ran " yarn add --dev react-test-renderer ". It returned the following error: yarn : 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 that the path is correct and try again. I’d really appreciate any help!

Hi! So what that means is that Windows doesn’t recognise yarn as a possible command, have you definately installed yarn and added it to path?

Thanks so much for your reply! I don’t think I have then! I’ll just google the command…

Kind regards,
Ms Vicky Rai

Yarn lists the installation commands on their website if that’ll help:


Thanks so much! Does Yarn need to be installed every time I want to use it or just once?

Kind regards,


Just the once!

Lyall :slight_smile:

Thanks again! So I installed it and then tried to check the version. I got the following error message:

yarn : File C:\Users\Vicky\AppData\Roaming\npm\yarn.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see

about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.

At line:1 char:1

  • yarn --version

  • CategoryInfo : SecurityError: (:slight_smile: , PSSecurityException

  • FullyQualifiedErrorId : UnauthorizedAccess

Kind regards,


So windows has Execution polices that prevent unauthorised scripts from running and it seems like they are being triggered for some reason, what command did you use to install yarn?


I used npm install -g yarn

Kind regards,


So what I think has happened is yarn’s version command runs a powershell script to check the version and then output that to the user.
The problem is that for security reasons windows blocks unauthorised powershell scripts from executing, is it just --version that doesn’t work or is it all yarn commands?
(I might end up being completely wrong but that’s just the impression I got from the error message and what I could find online :slight_smile: )


FWIW, these environments run perfectly fine in a limited user account if they are properly configured. We should not need Admin privileges to run them, and if we do, then the installation or set up is wrong.

It installed fine but I can’t run any commands!

Thanks so much for your help so far! I’ll run it past my course tutor and see what he says! Will update this thread with his answer!

Kind regards,

Vicky Rai

1 Like

This is what my tutor said:

Regarding the issue with Yarn, there is a way to allow the PS to run yarn but it is something that I am not familiar with and would not recommend. My suggestion is that you run your scripts using either CMD or Git Bash.