Tag Archives: C:\Users\Administrator\AppData\Roaming\npm\yarn.ps1

[Solved] Failed to load the file C:\Users\Administrator\AppData\Roaming\npm\yarn.ps1, because script execution is prohibited in this system.

An error is reported after executing yarn install:

Unable to load file C:\Users\Administrator\AppData\Roaming\npm\yarn.ps1, because script execution is prohibited in this system.

Solution:

Runs PowerShell as administrator (Win7 location: C:\Windows\System32\WindowsPowerShell\v1.0)

Execution: set-ExecutionPolicy RemoteSigned

[Solved] yarn: Unable to load the File C:\Users\Administrator\AppData\Roaming\npm\yarn.ps1, Because running scripts is prohibited on this system.

Problem Description: yarn is used in vscode terminal to report an error

Specific error information:

yarn: Unable to load the File C:\Users\Administrator\AppData\Roaming\npm\yarn.ps1, Because running scripts is prohibited on this system. For more information, please refer to https:/go.microsoft.com/fwlink/?LinkID=135170
About_Execution_Policies.
Location Line: 1 Character: 1
+ ~~~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

Solution:

1. Open windows PowerShell in administrator mode (the general shortcut key win + X can wake up for selection)

2. Enter get executionpolicy in PowerShell and return restricted

3. PowerShell input set executionpolicy remotesigned

4. PowerShell returns the result and enters y for setting

Execute policy changes
Execution strategies can help you prevent the execution of untrusted scripts. Changing the execution strategy may create security risks, such as https:/go.microsoft.com/fwlink/?LinkID=135170
As described in the about_Execution_Policies help topic. Do you want to change the execution strategy?
[Y] Yes (Y) [A] All Yes (A) [N] No (N) [L] All No (L) [S] Pause (S) [?] Help (default is "N"):