5

Check current react native CLI version

react-native -v
react-native-cli: 1.0.0
react-native: 0.61.5

I use the following commands to upgrade global react-native-cli verison

npm uninstall -g react-native-cli
npm install -g react-native-cli

but now check current react native cli version, it's still v1.0.0

react-native -v
react-native-cli: 1.0.0
react-native: 0.61.5

How to upgrade the react-native-cli?

Hardik Virani
  • 1,687
  • 7
  • 23
  • 36
user2992029
  • 161
  • 1
  • 2
  • 6
  • I found the root cause why I can get the updated version of `react-native-cli`. it's because I have installed two react-native,`/Users/xx/.nvm/versions/node/v10.16.0/bin/react-native` and `/usr/local/bin/react-native`, the second one is not installed by npm, so after I remove the folder, I can get latest information: `react-native -v` `react-native-cli: 2.0.1` `react-native: 0.61.5` – user2992029 Jan 10 '20 at 04:07

2 Answers2

2

The Homebrew way

Remove globally first if needed

npm uninstall -g react-native-cli

or

yarn remove react-native-cli

Install brew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install it with brew

brew install react-native-cli

Upgrade in future

brew upgrade react-native-cli
Leo
  • 10,407
  • 3
  • 45
  • 62
0

Since you are using react-native 0.61.5 you need to install react-native-cli version 3.0.0 or above according to Compatibility of React Native CLI.

If you have already installed a version of react-native CLI, uninstall it using

npm uninstall -g react-native-cli

Then try to install react-native CLI as below,

npm install react-native-cli@3.0.0

Hope this will help you.

Note: This may not work with react-native-cli version 4.0.0 or above.

SDushan
  • 4,341
  • 2
  • 16
  • 34