How to have create-react version 2 above? - reactjs

I'm following one of the tutorial for reactjs. Now one of the topic is to check the version of my react-script in the package.json file. When I checked it's in version 0.9.5 but the instructor's copy is in 1.0+ now I want to upgrade my version my running npm install react-script#latest now it successfully updated to 2.0.5 but when I tried to create a new app using create-react-app myproject it's still using the 0.9.5 how can I install a new app with the latest version of react-scripts?

You are updating the local version of create-react-app but then you're using the global one.
You should follow the official documentation about this: https://create-react-app.dev/docs/getting-started
The main points are:
Ensure you have npm > 5.2
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.
npx create-react-app my-app (to create a new react app)

Related

How to update the create react app to its latest version?

I am trying to update the create-react-app to its latest version. In the docs, they have mentioned using the below command to update the react scripts to 5.0.0.
sudo npm i create-react-app#5.0.0
I wonder if there is any way to update create-react-app to its latest stable released version without knowing the exact version.
Updating your an existing project build tooling is typically a daunting and time-consuming task. When new versions of Create React App are released, you can upgrade using a single command:
npm install react-scripts#latest
In most cases bumping the react-scripts version in package.json and running npm install (or yarn install) should be enough.
When you run npx create-react-app my-app it automatically installs the latest version of Create React App.
Create React App creates the project with the latest version of react-scripts so you’ll get all the new features and improvements in newly created apps automatically.
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 or yarn global remove create-react-app to ensure that npx always uses the latest version.
Reference: https://create-react-app.dev/docs/updating-to-new-releases

Error using create-react-app. We no longer support global installation of Create React-App

I am using the command npx create-react-app React-app, but it shows me the following error.
You are running `create-react-app` 4.0.1, which is behind the latest release (5.0.1).
We no longer support global installation of Create React App.
I tried npx create-react-app#5.0.1 React-app, but it didnt work as well.
I have updated versions of npm and node.
npx clear-npx-cache
you can try this one and also check this post where you can find possible solutions : "You are running create-react-app 4.0.3 which is behind the latest release (5.0.0)"
You are using older global version of creat-react-app.
Please Kindly check the global version and update the version with below command
npm install -g create-react-app#5.0.1
or
npm install -g create-react-app#latest
Note : As you can see in the error there is no need to install creat-react-app globally so you can also uninstall the creat-react-app globally using below command
npm uninstall -g create-react-app
name of the project must be start whit lowwercase

Getting this error while creating a new react app. Also tried the uninstall command but it doesnt work

While creating a new react app using npx create-react-app my-app i am getting this error saying "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." How can i solve this. Even tried using the uninstall command
create-react-app error
If you've previously installed create-react-app globally via npm install -g create-react-app, it's recommended you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.
You’ll need to have Node 14.0.0 or a later version on your local development machine (but it’s not required on the server). Its recommend to use the latest LTS version. You can use nvm (macOS/Linux) or nvm-windows to switch Node versions between different projects.
Moreover Here is the Documentation
You must first update the node version
and run
npx create-react-app app-name

how can i fix this issue aboute this command in reactjs

You are running create-react-app 4.0.1, which is behind the latest release (4.0.2).
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/
not working these command
npm uninstall -g create-react-app
yarn global remove create-react-app

create-react-app bash: /usr/local/bin/create-react-app: No such file or directory

I had an origonal problem that I tried to fix and got another problem
1. ORIGONAL PROBLEM
I just tried to install a new react app using create-react-app and got this error first
Please note that global installs of create-react-app are no longer supported.
The node modules were installed but none of the other files or directories that normally install.
2. What I did to fix Origonal problem
on the react app website it https://create-react-app.dev/docs/getting-started/ it was suggested that I do the following (which I did)
"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."
I tried to run the command npm uninstall -g create-react-app but could not do it as my mac prevented it so ran sudo npm uninstall -g create-react-app
3. New PROBLEM
When I now run create-react-app I get the message
bash: /usr/local/bin/create-react-app: No such file or directory
TDI-MacBook-Air:Active bob$
What do I need to do to get create react App back. I am worried about messing up my installation more so am hesitant to go at it without some advice
Just simply run npx create-react-app app_name to create your app.
npx will fetch the latest version of create-react-app and setup your app.
This solved my error Just simply run npx create-react-app app_name to create your app. npx will fetch the latest version of create-react-app and setup your app.

Resources