[react-native] How to check the installed version of React-Native

I'm going to upgrade react-native but before I do, I need to know which version I'm upgrading from to see if there are any special notes about upgrading from my version.

How do I find the version of react-native I have installed on my Mac?

This question is related to react-native

The answer is


If you have installed "react-native" globally then just open terminal/command line tool and type react-native -v you will get your answer.

And if you have installed "react-native" for a specific project then open terminal/command line tool and then navigate to your project and type react-native -v you will get your answer.


To see the local packages installed in your project including their versions and without their dependencies, run the below command from the project's root directory. In a React native app this would include the react-native package.

npm list --depth 0

Or if you installed them with yarn:

yarn list --depth=0

And to get just a specific package:

npm list react-native --depth 0
yarn list --pattern react-native --depth=0

Just Do a "npm audit" on your project directory and then go to your project package.json file. In the package.json file you will find all the versions and the package names.This should work irrespective of the OS.


react-native Usage: bin [options]

Options: --version Print CLI version --verbose Increase logging verbosity -h, --help output usage information react-native --version use this command


Check your Package.json file to know react-native version.

OR

Open terminal and run command react-native -v


You can run this command in Terminal:

react-native --version

This will give react-native CLI version

Or check in package.json under

"dependencies": {
    "react": "16.11.0",
    "react-native": "0.62.2",
}

Use react-native info It shows all system and libraries information...

Result :-

System:
    OS: Linux 5.4 Ubuntu 20.04.1 LTS (Focal Fossa)
    CPU: (4) x64 Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz
    Memory: 787.22 MB / 11.59 GB
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 12.18.4 - /usr/bin/node
    Yarn: 1.22.4 - /usr/bin/yarn
    npm: 6.14.6 - /usr/bin/npm
    Watchman: Not Found
  SDKs:
    Android SDK:
      API Levels: 22, 26, 27, 28, 29
      Build Tools: 26.0.2, 28.0.3, 29.0.2, 29.0.3, 30.0.0, 30.0.0
      System Images: android-R | Google Play Intel x86 Atom
      Android NDK: 21.1.6352462
  IDEs:
    Android Studio: Not Found
  Languages:
    Java: 11.0.8 - /usr/bin/javac
    Python: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.3 => 0.63.3 
  npmGlobalPackages:
    *react-native*: Not Found

If you want to see which version of react-native, react or another one you are running, open your terminal or cmd and run the desired command

npm view react-native version
0.63.4
npm view react version
17.0.1
npm view react-scripts version
4.0.1
npm view react-dom version
17.0.1

see my terminal


First, make sure npm is installed on your system. Use: [sudo] npm install npm -g to download and install it.


The best practice for checking the react native environment information.

react-native info

which will give the information

React Native Environment Info:
System:
  OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver)
  CPU: (8) x64 Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
  Memory: 2.08 GB / 7.67 GB
  Shell: 4.4.19 - /bin/bash
Binaries:
  Node: 8.10.0 - /usr/bin/node
  Yarn: 1.12.3 - /usr/bin/yarn
  npm: 3.5.2 - /usr/bin/npm
npmPackages:
  react: 16.4.1 => 16.4.1 
  react-native: 0.56.0 => 0.56.0 
npmGlobalPackages:
  react-native-cli: 2.0.1
  react-native: 0.57.8

You have two option

  1. run in cmd or Terminal
react --version
react-native --version
  1. check in the project files, open the Package.json


Find out which react-native is installed globally:

npm ls react-native -g

Move to the root of your App then execute the following command,

react-native -v

In my case, it is something like below,

MacBook-Pro:~ admin$ cd projects/

MacBook-Pro:projects admin$ cd ReactNative/

MacBook-Pro:ReactNative admin$ cd src/

MacBook-Pro:src admin$ cd Apps/

MacBook-Pro:Apps admin$ cd CabBookingApp/

MacBook-Pro:CabBookingApp admin$ ls
MyComponents        __tests__       app.json        index.android.js    
ios         package.json
MyStyles        android         img         index.ios.js        
node_modules

Finally,

MacBook-Pro:CabBookingApp admin$ react-native -v
react-native-cli: 2.0.1
react-native: 0.44.0

You can also open your package.json file in node_modules -> react-native.

The version is at the top:

 {
  "name": "react-native",
  "version": "0.12.0",
  ...
 }