37

Command Prompt showing create react app, not working

Help! I have no idea what is going on here, create react app is not working I have also tried reinstalling and yet to no avail, please help!

Npm version: 5.4.2 Node version: 8.70

Tried the npm install --save --save-exact --loglevel error react react-dom react-scripts

enter image description here

Zubair Amjad
  • 463
  • 2
  • 5
  • 10
  • Please post your node and npm versions (`node -v` and `npm -v` respectively). Checking github issues might be helpful as well. – goldins Dec 16 '17 at 06:12
  • Hey there, I have updated the post with my node and npm versons! – Zubair Amjad Dec 16 '17 at 06:15
  • what does the log file say? – Pankaj Gadge Dec 16 '17 at 06:19
  • Hmmm... I cannot reproduce this. Can you try copying and running the `npm install --save --save-exact ...` command? Also, I saw you posted this question on github. I don't know what the stackoverflow best practice is, but if you get an answer there, please repost it as a solution here as well. – goldins Dec 16 '17 at 06:21
  • Hey there I have updated it again, It seems like it is the same error with the JSON Parse – Zubair Amjad Dec 16 '17 at 06:58
  • Possible duplicate of [JSON Error when create react app](https://stackoverflow.com/questions/44683555/json-error-when-create-react-app) –  Dec 16 '17 at 07:31
  • [**Do not post images of code or errors!**](https://meta.stackoverflow.com/q/303812/995714) Images and screenshots can be a nice addition to a post, but please make sure the post is still cle ar and useful without them. If you post images of code or error messages make sure you also copy and paste or type the actual code/message into the post directly. – Rob Nov 18 '18 at 04:48

23 Answers23

71

In my case, "create-react-app" was not installed. to install run this command

 npm install -g create-react-app

Once installation successful, try running

npx create-react-app hello-world

If this works for you. Great else comment what worked for you,

UniCoder
  • 3,005
  • 27
  • 26
  • 5
    This actually work, Since, I wasn't getting any error on the cmd. But the problem I faced was incomplete `create-react-app` setup. So, running `npx create-react-app hello-world` saved me from trouble. – Akolade Adesanmi Jan 14 '20 at 09:47
  • this option didn't install full project – amal50 Mar 23 '20 at 21:46
47

Please try this:

npm cache clean --force
10

I also got the same issue and tried to resolve for a long and finally resolved using this command,

npx create-react-app@latest my-app --use-npm
7

I had the same problem and had to do the following:

npm uninstall -g create-react-app

npm uninstall create-react-app

After this I was able to create the app with:

npx create-react-app project-app
stromyc
  • 488
  • 6
  • 13
3

I had the same problem, and I solved it by:
1. update the npm version (npm install npm@latest -g)
2. clear the cache (npm cache clean --force)
3. create the react project (npx create-react-app todo)
(create-react-app was already installed)

3

I had similar issue while tried creating new react app with create-react-app, but related to some random JSON reading issues while installations like.. >= 5.0 || 4.0 ..

But the fix below solves multiple and similar issues.

First of all, make sure you have required or latest version of node installed.

npm install npm@latest -g

Before using create-react-app make sure you clean npm cache using npm cache clean --force

Now, is should be fine to create new react app with npx create-react-app tl-app or npx create-react-app . if you want to create current directory as project root.

Bhuwan Maharjan
  • 515
  • 4
  • 7
2

Make sure you are not running any antivirus, stop/pause all antivirus or protection software.

You can also try

use create-react-app projectname --save
or create-react-app projectname --save-exact and start again

OR

as the error suggests, you should use a newer version of node. You are using 8.9.4, you should probably use 8.12.0 LTS.

Pir Abdul
  • 2,274
  • 1
  • 26
  • 35
  • It was the anti-virus software. I am using bit-defender anti-virus, disabled it completely for 30 mins and tried running the command it worked. – ChrisOdney Jun 15 '21 at 12:41
1

It sets up your development environment so that you can use the latest JavaScript features, provides a nice developer experience, and optimizes your app for production.

You’ll need to have Node >= 8.10 and npm >= 5.6 on your machine. To create a project, run:

npx create-react-app my-app

cd my-app

npm start

Note: npx on the first line is not a typo — it’s a package runner tool that comes with npm 5.2+.

Create react app provides more information regarding this.

It may be the problem of cache also, so can also try:

npm cache clean --force

Edit 1: This may be due to slow internet speed, Please check the internet and try again.

Ramlal S
  • 1,573
  • 1
  • 14
  • 34
1

npx create-react-app .

( the .) means create project on this folder so you should manually create if you do that

Kipruto
  • 721
  • 6
  • 16
1

For the windows machine following command worked for me

yarn create react-app my-app
cd my-app
yarn set version berry
yarn
yarn start
Niki
  • 1,566
  • 1
  • 19
  • 36
0

The problem on my machine was caused by yarn. I am windows 10 and after uninstalling yarn using npm uninstall -g yarn, my script run correctly. So

  1. Open terminal and type: npm uninstall -g yarn
  2. Once done, close terminal and open new one
  3. type create-react-app (app name) and this should create your app :)

Please note that the above steps assume that you already have node and react-cli installed on your machine.

0

on Ubuntu 18.04

sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Milán Nikolics
  • 503
  • 2
  • 5
  • 23
0

What I did, is going to

C:\Users\mycomputerName\AppData\Roaming\npm\

I changed the name of this file

create-react-app.ps1

to

create-react-appOld.ps1

or you can delete it, then it worked fine

amal50
  • 981
  • 2
  • 21
  • 35
0

Tried all the above methods but no luck:(

Step1 : Reinstalled Node js

Step2 : Check whether environment variables has been created. if not create one for nodejs,npm and composer

enter image description here

Step3: Also add "C:\Windows\System32" to the global PATH environment variable.

Step4: Then use "npx create-react-app my-app" to create react project

Step5: Run the commmand : cd my-app and npm start

Step6: It will work

0

I finally got it to work. An anti-virus in my system was causing it not to work property. I unistalled it and it's working as expected.

0

After no luck with updating my npm version and doing npm cache clean --force I ended up just doing a fresh install of node which fixed the issue for me.

0

HAD the same problem. Running Node with cra. installed cra -g for starters.

npm install -g create-react-app

then downgraded react-scripts to version 2.1.8

npm install react-scripts@2.1.8

created a .env file in root directory and added this to it.

DB_HOST=localhost
DB_USER=root
DB_PASS=s1mpl3

SKIP_PREFLIGHT_CHECK=true

Then you do the typical delete node_modules folder and the package-lock.json file.(NOT PACKAGE.JSON!!!)

then:

npm install
npm start

This worked for me. Sorry I'm not more informative on why this worked for me. I'm still trying to understand why it didn't work in the first place.

djossir
  • 73
  • 1
  • 6
0

I just did it now after messing around with it all yesterday.

Installed react globally like people have said.

then I used 'git bash here' to open terminal in the directory i want

oddly, it worked when I removed npm. I know it's weird, I've never had to do that and it makes no sense but its working so:

create-react-app my-app-name

I'm on windows 10 by the way.

Stephen M
  • 36
  • 6
0

If there is anyone having this issue that you can not find your project when you

yarn create-react-app (name of project) npx create-react-app (name of project)

then just be sure that you are in the right directory.

use this command in your terminal

cd ..

now search the project name by

cd (project name)

you should find your directory here.

0

Please do this, I hope it will fix all of your problems

1- npm i -g create-react-app
2- create-react-app my-app
0

Find the folder and where a folder named npm is present and add it into environment variables (path)

0

The following worked for me.

In the directory where your project is located type in the following:

npm install -g npm@9.8.1

Then I ran the command:

npx create-react-app <name of your project>
minTwin
  • 1,181
  • 2
  • 21
  • 35
-4

I also experienced the same problem and SOLVED IT. This is what I did.

  1. Restart your machine(computer)
  2. Deactivate your anti-virus. I chose the "permanently" option
  3. Open the terminal and run the "create-react-app" command again, It will definitely do the trick.
  4. Activate your anti-virus
  5. And get working :-)
Vince T
  • 1
  • 1