162

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?

Emre Kenci
  • 2,715
  • 4
  • 26
  • 35

23 Answers23

196

To see what version you have on your Mac(Window also can run that code.), run react-native -v and you should get something like this:

enter image description here

If you want to know what version your project is running, look in /node_modules/react-native/package.json and look for the version key:

enter image description here

kit
  • 1,166
  • 5
  • 16
  • 23
Nader Dabit
  • 52,483
  • 13
  • 107
  • 91
  • 1
    Can I check package.json of the project root folder (not node_module) to check the version there is also a key value like **"react-native": "0.49.3"** – Yusuf Khan Apr 09 '19 at 07:19
  • Huh, so many upvotes, don't u guys get the error after running the command above. – Ayush Kumar Jun 10 '21 at 14:13
55

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
Zeeshan Ansari
  • 9,657
  • 3
  • 26
  • 27
  • 2
    This is the one that works for me. The `-v` command doesn't work. This `info` command took quite long time to finish though. – Chen Li Yong May 20 '20 at 03:52
38

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",
  ...
 }
John Roberts
  • 467
  • 3
  • 5
  • 3
    I don't think this is true, `react-native -v` returns `0.48.4` while my `package.json` says `0.1.0`. – paulvs Nov 26 '17 at 23:45
  • 3
    it actually true. react-native and react-native-cli are different things. @paulvs – hakki Dec 09 '19 at 11:37
37

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

17

this works for me

npm view react-native version

Output is: 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`

Nasreen Ustad
  • 1,564
  • 1
  • 19
  • 24
16

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
hygull
  • 8,464
  • 2
  • 43
  • 52
11

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
Steve Carey
  • 2,876
  • 23
  • 34
7

Find out which react-native is installed globally:

npm ls react-native -g
Bill Zelenko
  • 2,606
  • 1
  • 17
  • 26
7

If you are using npx you can run:

npx npm view react-native version
programandoconro
  • 2,378
  • 2
  • 18
  • 33
2

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.

Divyang Solanki
  • 901
  • 1
  • 9
  • 24
2

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",
}
Rohan Rao
  • 2,505
  • 3
  • 19
  • 39
Swift
  • 829
  • 2
  • 12
  • 33
2

I know 2 ways to test react-native version

  1. Open cmd and type 'react-native --v' or 'react-native --version'
  2. Open your project and open package.json file. U will see react-native version
1

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

baduker
  • 19,152
  • 9
  • 33
  • 56
1

If you installed react native globally, on your terminal type:

  react-native --version

But if you installed without the global flag -g, type:

 npx react-native --version

Or

 yarn react-native --version

(If you have yarn installed)

Digi Coder
  • 76
  • 1
  • 6
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.

sg28
  • 1,363
  • 9
  • 19
0

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

B--rian
  • 5,578
  • 10
  • 38
  • 89
Chaurasia
  • 494
  • 1
  • 6
  • 22
0

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

OR

Open terminal and run command react-native -v

Ravi Sharma
  • 507
  • 6
  • 21
0

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

Swift
  • 829
  • 2
  • 12
  • 33
0

If you have installed "react-native" globally then just open your terminal and use react-native -v to get the version installed on your pc.

0

Just open the below file in your project :-

package.json

under dependencies object you will get the version of react-native

Meisan Saba
  • 800
  • 2
  • 9
  • 25
thinkerBOB
  • 128
  • 2
  • 11
0

To see what version you have on your Mac terminal, run react-native --version and you should get something like this:

0

To know the react native version, just type the command.

npx react-native --version
0

Another option for checking react-native version with npx is :

npx react-native info