[英]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
I think you are using Windows, I came across the same problem and it's because of a security feature in your system.我认为您使用的是 Windows,我遇到了同样的问题,这是因为您的系统中存在安全功能。
set-executionpolicy remotesigned
set-executionpolicy remotesigned
This worked for me.这对我有用。
Sources: https://www.faqforge.com/windows/windows-powershell-running-scripts-is-disabled-on-this-system/来源: https : //www.faqforge.com/windows/windows-powershell-running-scripts-is-disabled-on-this-system/
Make sure you remove create-react-app
from npm
globally and use npx create-react-app {project_name}
to generate a react app.确保从
npm
全局删除create-react-app
并使用npx create-react-app {project_name}
生成反应应用程序。
npm uninstall --global create-react-app
npx create-react-app sample
also, make sure that your npm version is after 5.2 while doing these.另外,在执行这些操作时,请确保您的 npm 版本在 5.2 之后。
Run power shell as admin以管理员身份运行 power shell
set-executionpolicy remotesigned
set-executionpolicy remotesigned
cd to the folder you want to create the app in it and type the following cd 到您要在其中创建应用程序的文件夹并键入以下内容
this worked for me这对我有用
试试这个命令: npx create-react-app yourappname
只需以管理员身份运行Power shell ,然后执行命令: set-executionpolicy remotesigned
Just stop your node server in "task manager", and start.只需在“任务管理器”中停止您的节点服务器,然后启动。 After that try to install with npx or npm .
之后尝试使用npx或npm安装。
Hope it is useful.希望它有用。
Don't worry, I also got this error.别担心,我也遇到了这个错误。 This error comes when you try to write the command create-react-app
当您尝试编写命令 create-react-app 时出现此错误
when you type the command npm install -g create-react-app, after running this command you should restart the command prompt or command powershell whatever you are using.当您键入命令 npm install -g create-react-app 时,运行此命令后,您应该重新启动命令提示符或命令 powershell,无论您使用什么。 After restarting command prompt now you can type create-react-app cmd.
现在重新启动命令提示符后,您可以键入 create-react-app cmd。
如果您是 Windows 操作系统用户,请打开您的 Powershell 并将以下命令粘贴到您的 PowerShell cmd -> set-executionpolicy remotesigned。
This error comes because Microsoft changed some PowerShell execution policies for your security.出现此错误是因为 Microsoft 为您的安全更改了一些 PowerShell 执行策略。
We can create react app from mainly two places.我们主要可以从两个地方创建 react 应用程序。
Hope it will work for you.希望它对你有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.