[英]I am trying to create react app but keeps on telling me unauthorized access
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
Problem:问题:
This error comes when the PowerShell execution policy doesn't allow us to run scripts.当 PowerShell 执行策略不允许我们运行脚本时,就会出现此错误。 I also found the same error when tried to run a PowerShell script.
我在尝试运行 PowerShell 脚本时也发现了同样的错误。
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".如果您没有管理员访问权限,请按照以下命令 =>“Set-ExecutionPolicy -Scope CurrentUser”。
The PowerShell execution policy is default set to Restricted. PowerShell 执行策略默认设置为受限。 You can change the PowerShell execution policies with Set-ExecutionPolicy cmdlet.
您可以使用 Set-ExecutionPolicy cmdlet 更改 PowerShell 执行策略。 To run outside script set policy to RemoteSigned.
运行外部脚本集策略到 RemoteSigned。
PS C:\> Set-ExecutionPolicy RemoteSigned
Below is the list of four different execution policies in PowerShell下面是 PowerShell 中四种不同执行策略的列表
Restricted – No scripts can be run.受限– 不能运行任何脚本。
AllSigned – Only scripts signed by a trusted publisher can be run. AllSigned – 只能运行由受信任发布者签名的脚本。
RemoteSigned – Downloaded scripts must be signed by a trusted publisher. RemoteSigned – 下载的脚本必须由受信任的发布者签名。
Unrestricted – All Windows PowerShell scripts can be run.不受限制- 可以运行所有 Windows PowerShell 脚本。
You Should Also Know:你还应该知道:
You can use get the current set execution policy in PowerShell.您可以在 PowerShell 中使用获取当前设置的执行策略。
PS C:\> get-executionpolicy
You can bypass this policy by adding -ExecutionPolicy ByPass when running PowerShell script.您可以通过在运行 PowerShell 脚本时添加 -ExecutionPolicy ByPass 来绕过此策略。
c:\> powershell -ExecutionPolicy
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.