Bon*_*ura 0 javascript node.js express
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
Run Code Online (Sandbox Code Playgroud)
小智 6
问题:
\n当 PowerShell 执行策略不允许我们运行脚本时,就会出现此错误。当尝试运行 PowerShell 脚本时,我也发现了同样的错误。
\nPowerShell - running scripts is disabled on this system
解决方案:
\n如果您没有管理员访问权限,请按照以下命令执行\n=>“Set-ExecutionPolicy -Scope CurrentUser”。
\nPowerShell 执行策略默认设置为“受限”。您可以使用 Set-ExecutionPolicy cmdlet 更改 PowerShell 执行策略。要运行外部脚本,请将策略设置为 RemoteSigned。
\nPS C:\\> Set-ExecutionPolicy RemoteSigned \nRun Code Online (Sandbox Code Playgroud)\n下面是PowerShell中四种不同执行策略的列表
\n受限\xe2\x80\x93 无法运行脚本。
\nAllSigned \xe2\x80\x93 只能运行受信任发布者签名的脚本。
\nRemoteSigned \xe2\x80\x93 下载的脚本必须由受信任的发布者签名。
\n无限制\xe2\x80\x93 可以运行所有 Windows PowerShell 脚本。
\n您还应该知道:
\n您可以使用 PowerShell 中获取当前设置的执行策略。
\nPS C:\\> get-executionpolicy \nRun Code Online (Sandbox Code Playgroud)\n您可以通过在运行 PowerShell 脚本时添加 -ExecutionPolicy ByPass 来绕过此策略。
\nc:\\> powershell -ExecutionPolicy\nRun Code Online (Sandbox Code Playgroud)\n