npx create-react-app projectName fails to create project

818 views Asked by At

I am creating a react project using npx create-react-app experiment and I have been getting the below error, can anybody help with how to resolve it. NB, I have uninstalled global installations of create-react-app

(base) sibulele@sibulele-X555LAB:~$ npx create-react-app experiment

Creating a new React app in /home/sibulele/experiment.

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

yarn add v1.22.18
info No lockfile found.
[1/4] Resolving packages...

warning react-scripts > @svgr/webpack > @svgr/plugin-svgo > [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.

[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "react-scripts > eslint-config-react-app > [email protected]" has unmet peer dependency "@babel/plugin-syntax-flow@^7.14.5".

warning "react-scripts > eslint-config-react-app > [email protected]" has unmet peer dependency "@babel/plugin-transform-react-jsx@^7.14.9".

warning "react-scripts > react-dev-utils > [email protected]" has unmet peer dependency "typescript@>= 2.7".

warning "react-scripts > eslint-config-react-app > @typescript-eslint/eslint-plugin > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".

[4/4] Building fresh packages...
success Saved lockfile.
success Saved 745 new dependencies.
info Direct dependencies ...

Done in 377.81s.

A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported.


You can fix this by running npm uninstall -g create-react-app or yarn global remove create-react-app before using create-react-app again.
(base) sibulele@sibulele-X555LAB:~$ npm audit
found 0 vulnerabilities
(base) sibulele@sibulele-X555LAB:~$ 
2

There are 2 answers

0
Sibulele On

Thank you everyone. My question has been answered by @Kayzer161 on this post This SVGO version is no longer supported. Upgrade to v2.x.x .

Here is the answer:-

create a react app by this command, npx create-react-app@latest my-app --use-npm

I had a depreciated version of "tar" and I updated it by the following command:-

sudo npm i tar

2
todevv On

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 to ensure that npx always uses the latest version.

Use either one of the below commands:

  • npx create-react-app my-app

  • npm init react-app my-app

  • yarn create react-app my-app

if npm uninstall -g create-react-app stated above does not work. Type where create-react-app to know where it is installed. rm -rf /usr/local/bin/create-react-app to delete manually