Create-react-app not working even after uninstalling and reinstalling - reactjs

I've been having difficulties getting create-react-app to work on my mac. I created a new project and simply tried "npx create-react-app my-app" and it told me that my version of create-react-app was outdated and to uninstall it with "npm uninstall -g create-react-app" but after doing that I literally get 1 file that was audited and its completed. Then when I go and try to install it again I keep getting the same error message. The furthest the install goes is installing the node_modules, package-lock.json, and package.json files then stops and lets me know that my create-react-app is outdated and to do the same command. Im in this never ending loop of uninstalling and reinstalling.
Obviously, I am doing something wrong here. I've even done these commands
npm cache clean --force
npm cache verify
npx clear-npx-cache to clear your npx cache.
npx create-react-app your-app
and still it tells me that my create-react-app is outdated. screenshot of my terminal
I'm relatively new to react development but I have definitely started react projects before with no issues.

I had this same issue happen as did another colleague of mine. For me, installing it locally with npm install create-react-app worked and for him he had to uninstall and reinstall node

Related

Error while creating new react app (You are running `create-react-app` 5.0.0, which is behind the latest release (5.0.1).)

(I am using ubuntu.)
the message i am getting:
You are running create-react-app 5.0.0, which is behind the latest release (5.0.1).
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/
I have already tried:
npm uninstall -g create-react-app
npx clean-npx-cache
npx create-react-app#latest project-name
Nothing works
what should i do now?
I know it is late but...
I also had the same problem and every solution I found didn't seem to work. In the end I found it out.
I have both yarn and npm installed
create-react-app was installed in both and they were referencing each other
You need to perform both if you have both yarn and npm
npm uninstall -g create-react-app
yarn global remove create-react-app
Then clear cache using one (or both)
npx clear-npx-cache
npm cache clean -f
Then run to install and create the app
npx create-react-app#latest your-app-name
Hope it helps someone :)

You are running `create-react-app` 5.0.0, which is behind the latest release (5.0.1). We no longer support global installation of Create React App

I am new to React and have been sitting with this problem for the whole day now, I installed nodejs a few weeks back but earlier updated to newest version as well. I have tried all the suggestions, clearing cache, deleting 'npm uninstall -g create-react-app
yarn global remove create-react-app' but nothing works.
If I type
npx create-react-app my-app that error keeps coming up and nothing works. Please help me
This solution worked for me
npm i create-react-app
I managed to figure it out, thanks
The problem you are having is because the react no longer supports the global installation of create react app. To solve this problem, run these commands:
1- npm uninstall -g create-react-app;
2- npm install -g create-react-app;
that's will upgrade your npx, then run:
npx create-react-app my-app
Hope this solves your problem.

Try to solve error about create-react-app

Every time I try to run npx create-react-app my-app, the same error will show:
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.
I did whatever this error said. Try using another text editor rather than VSCode and try all of the ways that people suggested in related topics, but nothing works.
check whether create-react-app has been uninstalled by typing which create-react-app, if it is not uninstalled it will exit the create-react-app folder located ex : /usr/bin/create-react-app. then delete with rm /usr/bin/create-react-app
It is maybe because you are not using the latest create-react-app version.
If you are using npm 5.1 or earlier, you can't use npx. Instead, install create-react-app globally:
npm install -g create-react-app
then run:
npx create-react-app my-app
See all information here.
Hope this answers helps you.

Stuck in making a react project

guys. I'm having a trouble when using npx create-react-app script.
Whenever I try to create a react app, it's always show like this:
Creating a new React app in C:\USER\User\Document\GitHub\Projects
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
And it always stuck in there. I ever leave it for almost eight hours, but still it ain't work.
I've been trying to do npm install npm#latest -g to install the latest version of my npm, but still it doesn't work. I even have tried to uninstall the NodeJS in my computer, then reinstall it.
Earlier, I've always done my react projects with this method:
npm init
npm install create-react-app
npm create-react-app my-project
Unfortunately, after a week, I cannot do npm start for every react project that I've made before using that method. I also have tried to use the same method to create a new react project, but still it always stuck in the same part. I really need your help guys.
I'm using the latest version of VSCode on Windows 8.1 by the way.
Thank you in advanced.
Most likely you might be hosting an old version of create-react-app
Here are some processes for you to try out:
Uninstall the global version of create-react-app.
npm uninstall -g create-react-app
Run the following command to delete the create-react-app manually.
rm -rf /usr/local/bin/create-react-app
Now, you can use the npx create-react-app command to create a new app.

Create React App not working

Help! I have no idea what is going on here, create react app is not working I have also tried reinstalling and yet to no avail, please help!
Npm version: 5.4.2
Node version: 8.70
Tried the npm install --save --save-exact --loglevel error react react-dom react-scripts
In my case, "create-react-app" was not installed. to install run this command
npm install -g create-react-app
Once installation successful, try running
npx create-react-app hello-world
If this works for you. Great else comment what worked for you,
Please try this:
npm cache clean --force
I also got the same issue and tried to resolve for a long and finally resolved using this command,
npx create-react-app#latest my-app --use-npm
I had the same problem and had to do the following:
npm uninstall -g create-react-app
npm uninstall create-react-app
After this I was able to create the app with:
npx create-react-app project-app
I had the same problem, and I solved it by:
1. update the npm version (npm install npm#latest -g)
2. clear the cache (npm cache clean --force)
3. create the react project (npx create-react-app todo)
(create-react-app was already installed)
I had similar issue while tried creating new react app with create-react-app, but related to some random JSON reading issues while installations like.. >= 5.0 || 4.0 ..
But the fix below solves multiple and similar issues.
First of all, make sure you have required or latest version of node installed.
npm install npm#latest -g
Before using create-react-app make sure you clean npm cache using npm cache clean --force
Now, is should be fine to create new react app with npx create-react-app tl-app or npx create-react-app . if you want to create current directory as project root.
Make sure you are not running any antivirus, stop/pause all antivirus or protection software.
You can also try
use create-react-app projectname --save
or create-react-app projectname --save-exact and start again
OR
as the error suggests, you should use a newer version of node. You are using 8.9.4, you should probably use 8.12.0 LTS.
It sets up your development environment so that you can use the latest JavaScript features, provides a nice developer experience, and optimizes your app for production.
You’ll need to have Node >= 8.10 and npm >= 5.6 on your machine. To create a project, run:
npx create-react-app my-app
cd my-app
npm start
Note:
npx on the first line is not a typo — it’s a package runner tool that comes with npm 5.2+.
Create react app provides more information regarding this.
It may be the problem of cache also, so can also try:
npm cache clean --force
Edit 1: This may be due to slow internet speed, Please check the
internet and try again.
npx create-react-app .
( the .) means create project on this folder so you should manually create if you do that
For the windows machine following command worked for me
yarn create react-app my-app
cd my-app
yarn set version berry
yarn
yarn start
The problem on my machine was caused by yarn. I am windows 10 and after uninstalling yarn using npm uninstall -g yarn, my script run correctly. So
Open terminal and type: npm uninstall -g yarn
Once done, close terminal and open new one
type create-react-app (app name) and this should create your app :)
Please note that the above steps assume that you already have node and react-cli installed on your machine.
on Ubuntu 18.04
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
What I did, is going to
C:\Users\mycomputerName\AppData\Roaming\npm\
I changed the name of this file
create-react-app.ps1
to
create-react-appOld.ps1
or you can delete it, then it worked fine
Tried all the above methods but no luck:(
Step1 : Reinstalled Node js
Step2 : Check whether environment variables has been created. if not create one for nodejs,npm and composer
Step3: Also add "C:\Windows\System32" to the global PATH environment variable.
Step4: Then use "npx create-react-app my-app" to create react project
Step5: Run the commmand : cd my-app and npm start
Step6: It will work
I finally got it to work. An anti-virus in my system was causing it not to work property. I unistalled it and it's working as expected.
After no luck with updating my npm version and doing npm cache clean --force I ended up just doing a fresh install of node which fixed the issue for me.
HAD the same problem. Running Node with cra. installed cra -g for starters.
npm install -g create-react-app
then downgraded react-scripts to version 2.1.8
npm install react-scripts#2.1.8
created a .env file in root directory and added this to it.
DB_HOST=localhost
DB_USER=root
DB_PASS=s1mpl3
SKIP_PREFLIGHT_CHECK=true
Then you do the typical delete node_modules folder and the package-lock.json file.(NOT PACKAGE.JSON!!!)
then:
npm install
npm start
This worked for me. Sorry I'm not more informative on why this worked for me. I'm still trying to understand why it didn't work in the first place.
I just did it now after messing around with it all yesterday.
Installed react globally like people have said.
then I used 'git bash here' to open terminal in the directory i want
oddly, it worked when I removed npm. I know it's weird, I've never had to do that and it makes no sense but its working so:
create-react-app my-app-name
I'm on windows 10 by the way.
If there is anyone having this issue that you can not find your project when you
yarn create-react-app (name of project)
npx create-react-app (name of project)
then just be sure that you are in the right directory.
use this command in your terminal
cd ..
now search the project name by
cd (project name)
you should find your directory here.
Please do this, I hope it will fix all of your problems
1- npm i -g create-react-app
2- create-react-app my-app
Find the folder and where a folder named npm is present and add it into environment variables (path)
I also experienced the same problem and SOLVED IT.
This is what I did.
Restart your machine(computer)
Deactivate your anti-virus. I chose the "permanently" option
Open the terminal and run the "create-react-app" command again, It will definitely do the trick.
Activate your anti-virus
And get working :-)

Resources