0

I recently switched to Ubuntu, whenever I create react app it's giving me this note, and the app it's creating is a class component.

ankit@gram:~/Documents/Development/React/react-project$ npx create-react-app my-app

Creating a new React app in /home/ankit/Documents/Development/React/react-project/my-app.

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


added 987 packages in 39s

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

Success! Created my-app at /home/ankit/Documents/Development/React/react-project/my-app
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd my-app
  npm start

Happy hacking!

Note: the project was bootstrapped with an old unsupported version of tools.
Please update to Node >=14 and npm >=6 to get supported tools in new projects.

my node version: v16.14.0 my npm version:8.3.1

Ankit Kumar
  • 389
  • 3
  • 9

5 Answers5

0

I think this was because npx was not installed in my system, when I created a react app by this command create-react-app the app created was fine. I also installed npx using this command npm install -g npx and created a react app and everything was fine. before this make sure you have installed create-react-app in your system if not then install it by using this command sudo npm install -g create-react-app

Ankit Kumar
  • 389
  • 3
  • 9
0

I am a new programmer had this issue not long ago I just solved it.

Use sudo apt install nodejs

It will automatically install version 10 for you which doesn't accept React.

Then you try to install NVM package, use it to update your node to a newer version.

You can check me on GitHub bari racha Wuye

Roman Mahotskyi
  • 4,576
  • 5
  • 35
  • 68
  • 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](/help/how-to-answer). – Community May 14 '22 at 14:31
0

I was having the same problem after I had just installed Ubuntu 22.04.

The fix for me was updating node and npm by following these instructions free code camp update node and npm

Specifically, I followed the instructions under the heading "1. Use NPM to Update Your Node Version", to update node and ignored the 2nd and 3rd headings, then followed the instructions under the last heading to update npm

afterwards I restarted my computer, opened the project directory and ran the command

npm i create-react-app@latest

then I ran

npx create-react-app projectname

and it worked as expected

Jacob
  • 1
  • 1
0

In my case, I had two npm installed. On checking through terminal:

whereis npm 

I got this:

npm: /usr/local/bin/npm /snap/bin/npm

I checked their versions: the first one had 9.4.1 and next 9.5.0. So I uninstalled node which i had from snap (yeah it uninstalled the node completely). The recommended way to installing node is by using their official website. NodeJS Official Website

BEFORE DOING ANYTHING, Uninstall any previously installed version of NodeJS. It is recommended to look at EDIT 2 before doing anything.

Now head to NodeJS Download Page. Download it for your system (Linux in my case and more precisely Ubuntu 22.04). You will get a tar.xz file. You can refer to this answer on installing NodeJS on Linux through tar.xz.

Install NodeJS.

Now run this in the directory where you want to create your project:

npm init react-app your-app-name-here

Hope this helps! It worked in my case.

EDIT 1: After installing NodeJS (from their website) my npm version was 9.4.1.

EDIT 2: (IMPORTANT!) As of 21/3/2023 react.dev has been launched. In it's documentation there is no mention of creating a project using create-react-app. The only way to create a react-only project is by using vite or Parcel. (Though there are other options but they are frameworks that's why I said "react-only". You can check them here)

Using vite you can create a react project by following commands:

# npm 6.x
npm create vite@latest my-react-app --template react

# npm 7+, extra double-dash is needed:
npm create vite@latest my-react-app -- --template react

For more information, you can check this out

0

I had the same issue and after trying all suggested fixes I could find I found the cause. Turns out, while trying to troubleshoot a different app, I had installed a lower version of npm locally two directories up. The issue was resolved after I deleted the npm folder with the unwanted installation.