0

I'm trying to create-react-app but it's showing error

I've tried

  • npm cache clean --force
  • npx create-react-app .

Also used this but same issue occurs

  • npm install -g create-react-app

can anyone suggest how to fix this?

Gaurav Verma
  • 1
  • 1
  • 3

3 Answers3

1

npx is used for the libraries in node_modules in your project

Since you used -g (meaning global) to install create react app you should use

npm create-react-app

If you add create-react-app to your package json with

npm install create-react-app

you can then use npx to run the command.

Joe Lloyd
  • 19,471
  • 7
  • 53
  • 81
0

Check if your create react app version is compatible with your machine's node version. Upgrade or downgrade accordingly to match the two. This fixed the issue at my machine.

0

I got this mistake once and the reason was because I ran the "npm " commands without haven't "cd" into my react project.

i had the folder structure like:

  • Project
    • react-project (..contains all react boiler-plate code and files)

I was running "npm start" while been in "Project" directory. you have to "cd" into your react-app (..in this case 'react-project') before running any npm commands.

Rapha07
  • 1
  • 3