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,
JavaScript
x
8
1
yarn : File C:UsersmattjAppDataRoamingnpmyarn.ps1 cannot be loaded because running scripts is disabled on this
2
system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
3
At line:1 char:1
4
+ yarn --version
5
+ ~~~~
6
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
7
+ FullyQualifiedErrorId : UnauthorizedAccess
8
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,
JavaScript
1
2
1
Get-executionPolicy
2
returns restricted
I fixed it by running this in powershell:
JavaScript
1
2
1
set-executionpolicy remotesigned
2
then pressed
JavaScript
1
2
1
a
2
and it works