21

I am facing a problem with creating a new React app using CRA when I run the following command npx create-react-app my-app.

  • I tried to clear npm cache with this command npm cache clean --force
  • I also tried this command npm -g uninstall create-react-app

My node version is v14.15.3 and the npm version is 7.10.0
The error which I get is :

Need to install the following packages:
  create-react-app
Ok to proceed? (y)
6
  • this is not an error. what did you get after proceeding? Commented Apr 23, 2021 at 17:49
  • create-react-app is not recognized as an internal or external command... Commented Apr 23, 2021 at 22:56
  • it seems like a path variable issue. which OS are you using? Commented Apr 24, 2021 at 5:16
  • I am using windows 10 Commented Apr 24, 2021 at 16:31
  • could you check echo %Path% Commented Apr 24, 2021 at 17:38

10 Answers 10

44

Need to clear the cache on the npx:

npx clear-npx-cache

and then re-run

npx create-react-app <app-name>

and then accept (y)

Sign up to request clarification or add additional context in comments.

2 Comments

Worked like a charm. Clearing npx cache and re-running cra command worked.
Make sure you're using a current version of Node for this... Our app happens to be using 10.15.3 (barf) so the cache clean wouldn't work and the whole thing wouldn't work. Finally remembered to switch to Node 16+ with nvm, and this solution worked.
16

Just had the same problem. This worked for me:

  • npm -g uninstall create-react-app
  • npm cache clean --force
  • npm install -g create-react-app
  • npx create-react-app my-app

Comments

2

Just clear the cache by running, npx clear-npx-cache and then try to create your react app npx creact-react-app my-app.

Comments

1

When it said Ok to proceed? (y) I went through that twice and it told me the version I was using was no longer supported so, npm update

2 Comments

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review
1

Hi Oussama Bouchikhi,

You can try the following npm commands to solve the issue:

Run this first,

npm uninstall -g create-react-app

then

npm install -g create-react-app

Here's the snapshot of the same, create-react-app-issue

Let us know if it works! Happy Hacking!

Comments

1
  1. Options 1
    Switch to yarn instead of npm
    npm i -g yarn
    yarn create react-app
    
  2. Options 2
    Uninstal Node completely and re-instal it again
  3. Option 3
    Use nvm (Node Version Manager)

Comments

0

When it gives you this error, it asks your permission to install create-react-app

...
Ok to proceed? (y)

Type y in your terminal and press enter

You might find this helpful as well: https://create-react-app.dev/docs/getting-started/

If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.

1 Comment

I get this "create-react-app is not recognized as an internal or external command..."
0

could you try to add this path to your system variable? C:\Users\<user-name>\AppData\Roaming\npm

and try again with npx create-react-app <app-name>

3 Comments

I think it's already in the environment variables C:\Users\pc cam\AppData\Roaming\npm
in your path there is a space in your username. afaik it shouldn't be like this. space broke the path link I think
I changed the user name and I still get the same behavior
0

You need to clear your npx cache first.

Delete the folder _npx inside the path returned by npm config get cache

# In Linux/MacOS terminal
rm -rf `npm config get cache`/_npx

This can also be done with @snewn's method, I posted this in case you want to skip that dependency.

Comments

0

Need to clear the cache on the npx:

npx clear-npx-cache and then re-run

npx create-react-app and then accept (y)

2 Comments

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
This is the same as the top-voted answer, but without formatted code blocks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.