how to upgrade react-native-cli? - react-native

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?

🍺 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

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.

Related

react-native init is empty upon creation

i'm upgrading to react-native to the latest.
I'm following this https://reactnative.dev/docs/0.68/environment-setup
with current setup
ruby 2.7.5 (using rvm)
gem 3.1.6
node 14
after running this command
npx react-native init AwesomeProject
I only got this on my folder
Thank you.
Sorry,
I just fixed it by reinstalling these
npm uninstall -g react-native
npm uninstall -g react-native-cli
npm install -g react-native-cli
npm install -g react-native

When I open a new react-native project I always get this error

enter image description here
enter image description here
If you have installed react-native-cli globally uninstall using
npm uninstall -g react-native
npm uninstall -g react-native-cli
and then install again using
npm uninstall -g react-native
npm uninstall -g react-native-cli
This error is specifically for 0.69.0 version. You can also do
npx react-native init ProjectName --version="0.68.2"

Cant Install expo cli

I'm trying to install Expo CLI for React Native
The latest version of Node js also installed
in command prompt, I typed npm install expo-cli --global
I'm getting error
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
[..................] \ fetchMetadata: WARN deprecated request#2.88.2: request has been deprecated, see https://github.com
I also checked the GitHub issues/3142 but not found any solution
I was having the same issue install expo-cli with npm it gives WARN of request#2.88.2 deprecation, then what I did, simply install
npm install -g yarn
and after that
yarn global add expo-cli
and now it's successfully installed expo-cli, and I have the latest version of expo-cli as of today.
$ expo --version
3.15.4
It is not an error, it is just a warning so you should not worry. Everything seems fine. You can check your expo-cli installation within below command:
$ expo --version
2.21.2
By the way you don't have to install expo-cli at all. You can use npx expo init to create a expo project.
I had the same problem and it turned out my version of NodeJs was not supported. The documentation states that you need Node.js LTS release or greater.
This is the output when I attempted to install expo-cli then ran expo --version
Output:
ERROR: Node.js v12.10.0 is no longer supported.
expo-cli supports following Node.js versions:
* >=10.13.0 <11.0.0 (Maintenance LTS)
* >=12.13.0 <13.0.0 (Active LTS)
* >=14.0.0 <15.0.0 (Current Release)
I solved it by updating nodejs and reinstalled expo-cli with npm i --global expo-cli and it worked.

react-native -bash: react-native: command not found

I Install node and Watchman
brew install node
brew install watchman
then Install React Native CLI
npm install -g react-native-cli
but when I use react-native init test
I have error:
-bash: react-native: command not found
try: sudo npm install -g react-native-cli
or npx before react native as: npx react-native init demo
first
sudo npm install -g react-native-cli
this command output path like this
/usr/local/bin/react-native -> /usr/local/lib/node_modules/react-native-cli/index.js
then(for above path example)
export PATH="/usr/local/lib/node_modules/react-native-cli/index.js"
react-native init appName

Command "react-native" can not run after installed react-native-drawer

I inited React native project by:
react-native init MyShop
In MyShop folder, I install "react-native-drawer":
npm install --save react-native-drawer
After install, I run project by:
react-native run-android
And get error "Command run-android unrecognized. Make sure that you have run npm install and that you are inside a react-native project."
I checked react-native by command line
react-native -v
And get info:
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory
It seems react-native lib has been removed after installed react-native-drawer.
My npm version:
E:\2.Projects\My\MyShop>npm -v
5.0.4
My node version:
E:\2.Projects\My\MyShop>node -v
v8.1.2
Please help me re-procedure and fix it. Thank you!
I found out solution for this issue!
I update npm to latest version: 5.1.0.
Uninstall react-native-cli:
npm uninstall -g react-native-cli
Next, reinstall react-native-cli:
npm install -g react-native-cli
My issue has been fixed.
Install react-native without -cli
npm install -g react-native
It will fix the issue......Hopefully....coz