How to have create-react version 2 above?

Viewed 113

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?

1 Answers

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:

  1. Ensure you have npm > 5.2

  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.

  3. npx create-react-app my-app (to create a new react app)

Related