2

My question related to yarn. Before when I start create projects I installed with npm. After a long time when I want to start running with yarn it shows the following error:

yarn : File C:\Users\pc\AppData\Roaming\npm\yarn.ps1 cannot be loaded because running scripts is disabled on this system.

(in Windows machine, Powershell)

Windows: 10

I tried with git bash terminal it worked!
but not in my powershell terminal

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
  • Does this answer your question? [PowerShell says "execution of scripts is disabled on this system."](https://stackoverflow.com/questions/4037939/powershell-says-execution-of-scripts-is-disabled-on-this-system) – Scepticalist Aug 27 '21 at 08:35

2 Answers2

13

I have just fixed it by myself, anyway I am going to post answer here:

//open windows command Power shell as administrator and run command

  1. Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

  2. Set-ExecutionPolicy Unrestricted

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
0

Run the following code as administrator:

PowerShellSet-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
allexiusw
  • 1,533
  • 2
  • 16
  • 23