[英]I'm getting error like this while creating react app
-->
create-react-app : File C:\Users\ADMIN\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:1
+ create-react-app demo
我认为您使用的是 Windows,我遇到了同样的问题,这是因为您的系统中存在安全功能。
set-executionpolicy remotesigned
这对我有用。
来源: https : //www.faqforge.com/windows/windows-powershell-running-scripts-is-disabled-on-this-system/
确保从npm
全局删除create-react-app
并使用npx create-react-app {project_name}
生成反应应用程序。
npm uninstall --global create-react-app
npx create-react-app sample
另外,在执行这些操作时,请确保您的 npm 版本在 5.2 之后。
以管理员身份运行 power shell
set-executionpolicy remotesigned
cd 到您要在其中创建应用程序的文件夹并键入以下内容
这对我有用
试试这个命令: npx create-react-app yourappname
只需以管理员身份运行Power shell ,然后执行命令: set-executionpolicy remotesigned
只需在“任务管理器”中停止您的节点服务器,然后启动。 之后尝试使用npx或npm安装。
希望它有用。
别担心,我也遇到了这个错误。 当您尝试编写命令 create-react-app 时出现此错误
当您键入命令 npm install -g create-react-app 时,运行此命令后,您应该重新启动命令提示符或命令 powershell,无论您使用什么。 现在重新启动命令提示符后,您可以键入 create-react-app cmd。
如果您是 Windows 操作系统用户,请打开您的 Powershell 并将以下命令粘贴到您的 PowerShell cmd -> set-executionpolicy remotesigned。
出现此错误是因为 Microsoft 为您的安全更改了一些 PowerShell 执行策略。
我们主要可以从两个地方创建 react 应用程序。
希望它对你有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.