0
PS C:\Users\Bonnie_Py\Desktop\fullstack js>  create-react-app
react-app create-react-app : File C:\Users\Bonnie_Py Dev\AppData\Roaming\npm\create-react-app.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:2
 +  create-react-app react-app
 +  ~~~~~~~~~~~~~~~~
     + CategoryInfo          : SecurityError: (:) [], PSSecurityException
     + FullyQualifiedErrorId : UnauthorizedAccess
Codebling
  • 10,764
  • 2
  • 38
  • 66
Bonnie Nyambura
  • 331
  • 3
  • 6
  • 1
    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) – cbr Mar 10 '20 at 17:54

1 Answers1

6

Problem:

This error comes when the PowerShell execution policy doesn’t allow us to run scripts. I also found the same error when tried to run a PowerShell script.

PowerShell - running scripts is disabled on this system

Solution:

If you do not have admin access, follow the below with command => "Set-ExecutionPolicy -Scope CurrentUser".

The PowerShell execution policy is default set to Restricted. You can change the PowerShell execution policies with Set-ExecutionPolicy cmdlet. To run outside script set policy to RemoteSigned.

PS C:\> Set-ExecutionPolicy RemoteSigned 

Below is the list of four different execution policies in PowerShell

Restricted – No scripts can be run.

AllSigned – Only scripts signed by a trusted publisher can be run.

RemoteSigned – Downloaded scripts must be signed by a trusted publisher.

Unrestricted – All Windows PowerShell scripts can be run.

You Should Also Know:

You can use get the current set execution policy in PowerShell.

PS C:\> get-executionpolicy 

You can bypass this policy by adding -ExecutionPolicy ByPass when running PowerShell script.

c:\> powershell -ExecutionPolicy
Achu
  • 3
  • 4
Vivek Anand
  • 1,264
  • 8
  • 15
  • 1
    Thank you. This helped me. The thing you missed is "Run the PowerShell window as an administrator" or else it will show error. – Priyom saha Apr 09 '20 at 02:21