I'm getting error like this while creating react app

25,061

Solution 1

I think you are using Windows, I came across the same problem and it's because of a security feature in your system.

  1. Open powershell as an administrator.
  2. Run the following command set-executionpolicy remotesigned
  3. Try again.

This worked for me.

Sources: https://www.faqforge.com/windows/windows-powershell-running-scripts-is-disabled-on-this-system/

Solution 2

Make sure you remove create-react-app from npm globally and use npx create-react-app {project_name} to generate a react app.

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.

Solution 3

Run power shell as admin

  1. Windows Start
  2. Search for "Windows Powershell"
  3. Right click Windows Powershell
  4. Click Run as Administrator (Grant in "User Account Control" if shows up)
  5. Type set-executionpolicy remotesigned
  6. Select/Type yes [Y]

Solution 4

try this command : npx create-react-app yourappname

Solution 5

  • run cmd as adminstrator then
  • cd to the folder you want to create the app in it and type the following

    create-react-app myapp

    this worked for me

Share:
25,061
Admin
Author by

Admin

Updated on April 08, 2021

Comments

  • Admin
    Admin about 3 years
    -->
    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