Skip to content
Advertisement

can’t invoke yarn after installing with npm

I just got a upgraded my laptop and installed yarn via npm

and for some some reason when I try to invoke yarn --v it throws,

yarn : File C:UsersmattjAppDataRoamingnpmyarn.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: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

although, when i run yarn.cmd --v

it works fine?

is this an issue with path?

Advertisement

Answer

This might have to do something with powershell 5,

 Get-executionPolicy

returns restricted

I fixed it by running this in powershell:

set-executionpolicy remotesigned

then pressed

a

and it works

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement