2

Here in my terminal:

D:\>npx create-react-app myapp                                                                                      
npx: installed 98 in 21.893s                                                                                        

Creating a new React app in D:\myapp.                                                                               

Installing packages. This might take a couple of minutes.                                                           
Installing react, react-dom, and react-scripts with cra-template...                                                 


> core-js@2.6.11 postinstall D:\myapp\node_modules\babel-runtime\node_modules\core-js                               
> node -e "try{require('./postinstall')}catch(e){}"                                                                 


> core-js@3.6.5 postinstall D:\myapp\node_modules\core-js                                                           
> node -e "try{require('./postinstall')}catch(e){}"                                                                 


> core-js-pure@3.6.5 postinstall D:\myapp\node_modules\core-js-pure                                                 
> node -e "try{require('./postinstall')}catch(e){}"                                                                 

+ react-scripts@3.4.1                                                                                               
+ react-dom@16.13.1                                                                                                 
+ cra-template@1.0.3                                                                                                
+ react@16.13.1                                                                                                     
added 1613 packages from 750 contributors and audited 921730 packages in 287.89s                                    

58 packages are looking for funding                                                                                 
  run `npm fund` for details                                                                                        

found 1 low severity vulnerability                                                                                  
  run `npm audit fix` to fix them, or `npm audit` for details                                                       

My package.json after installing:

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "cra-template": "1.0.3",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-scripts": "3.4.1"
  }
}

Then it stucks there forever. I tried to install global create-react-app, update the newest npm, delete npm in Appdata and still not work, need help

le huy
  • 307
  • 1
  • 4
  • 8

2 Answers2

2

Since create-react-app 3.3.0 it's no longer recommended to use a global installation of CRA.

It was a raised issue on github but later got closed after this solution

npm rm -g create-react-app
npm install create-react-app
npx create-react-app my-app

All it does is:

Command 1: deletes the create-react-app installed globally

Command 2: Installs create-react-app locally

Command 3: Creates a new react-app with all the expected file structure.

Try this, if even that doesn't work, Check the following instructions...

Only For Windows Users

It was a problem for a lot of windows users.

Even after trying all the troubleshooting steps did not resolve the issue.

Finally it was found that they had some missing paths in their environment variables.

Note: We are not talking about setting npm path here

It did not get resolved until these were added to the env variables.

C:\Windows;C:\Windows\system32;C:\Windows\System32\Wbem

Its case-sensitive,paste it exactly as its mentioned

However, with time these errors have become fewer and fewer, not sure if this would help.

Community
  • 1
  • 1
Aditya Patnaik
  • 1,490
  • 17
  • 27
  • I updated my PATH with your code but still the same issue – le huy May 10 '20 at 08:01
  • Since create-react-app 3.3.0 it's no longer recommended to use a global installation of CRA. Hence try installing create-react-app locally....i have updated the answer, try giving command 2 as its mentioned – Aditya Patnaik May 10 '20 at 08:11
0

I encountered the same problem. Probably your Powershell's permission to run scripts is disabled for some reason.

  1. Open cmd from the start menu and run it by giving administrative privileges.
  2. Now type ' set-executionpolicy remotesigned ' and press enter.
  3. Then type Y or A.

Hope this helps. Worked for me.

Adithyan A
  • 15
  • 3