简体   繁体   English

我正在尝试创建 React 应用程序,但一直告诉我未经授权的访问

[英]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.

相关问题 我正在尝试创建反应应用程序但失败了。 它显示错误 - I am trying to create react app but failed. It show error 我正在尝试在 React 中创建一个盒子,但它不起作用 - I am trying to create a box in React, and it is not working 我正在尝试为网页创建聊天功能,当我按Enter键时,它会不断重新加载。 谁能告诉我为什么会这样吗? - I am trying to create a chat feature for a web page and it keeps reloading when I hit enter. Can anyone tell me why this might be happening? 我正在尝试使用“npx/npm create-react-app hello”命令创建一个反应应用程序并得到了整个消息 - I am trying to create a react app using the “npx/npm create-react-app hello” command and got this whole message PHP不断告诉我值是空的 - PHP keeps telling me value is empty 我是 React 新手,之前我创建了 React 应用程序但没有尝试创建 React 应用程序但是花了很长时间后出现错误 - I am new to react, previously I created react apps but not trying to create a react app but after taking a long time it is giving an error 为什么我总是面临 Mocha“超时错误”; 节点也一直告诉我要解决我的承诺? - Why do I keep facing a Mocha "timeout error"; Also node keeps telling me to resolve my promise? 我目前正在阅读 Eloquent JavaScript 并且我正在尝试解决递归测试,但是我的代码一直给我一个“未定义”的反馈 - I am currently reading Eloquent JavaScript and I'm trying to solve the recursion test, but my code keeps giving me an 'undefined' feedback URL 被阻止(Access-Control-Allow-Origin - Missing Header),而我正在尝试从 Bluehost 获取数据以响应网站应用程序 - URL blocked ( Access-Control-Allow-Origin - Missing Header) while I am trying to get the data from Bluehost to react website app 我正在尝试创建一个反应网站并在其中添加挂钩,但面临这个错误 - I am trying to create a react website and add hooks in it but face this erros
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM