Home > Software engineering >  Cannot create a react project
Cannot create a react project

Time:02-26

I'm trying to create a React project using npm but I'm failing because the global version of npm-create-react is no longer supported but even I follow what is told me to do it doesn't work anyway. When I try to use the command

npm init react-app my-app

I get this error from the console

Need to install the following packages:
  create-react-app
Ok to proceed? (y) y

You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).

We no longer support global installation of Create React App.

Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app

The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/

npm ERR! code 1
npm ERR! path /Users/nick/Documents/NFT
npm ERR! command failed
npm ERR! command sh -c create-react-app "my-app"

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/nick/.npm/_logs/2022-02-26T08_47_03_397Z-debug.log

After I receive this error I type the command

npm uninstall -g create-react-app

And in the terminal it gets printed the following message:


up to date, audited 1 package in 110ms

found 0 vulnerabilities

After this nothing changes, I still get the same error. How can I remove this? Thank you in advance.

CodePudding user response:

try running the create react app from npx like this

npx create-react-app app-name

CodePudding user response:

I made it work by using this command

npm install -g [email protected]

Then I could use again

npx create-react-app app-name

CodePudding user response:

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

npx create-react-app my-app
cd my-app
npm start

Link for doc

  • Related