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

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

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

'cb.apply is not a function' error running 'npx react-native init'

I want to learn React Native, so i read documents in Offical Site and I install some softwares. I installed JDK, Android Studio, NodeJs, Watchman..
At the least, When i use this command:
npx react-native init AwesomeProject
I got error:
npm ERR! cb.apply is not a function
I tried to graceful, but it didn't work.
npm install graceful-fs --save-dev
So what should I do ?
I'm using Linux Mint 18.
you most install npm:
install npm
than install react-native :
npm install -g
react-native-cli && npm install -g react-native (admin or sudo)
then for create project use:
react-native init MyProject
than go to project folder with :
cd Myproject
and finally use this for run project:
react-native run-ios or run-android

how to upgrade react-native-cli?

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.

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

Why does react-native uinstall after running react-native command to install a package?

I installed react-native globally and confirmed installation on Windows 10. Then I ran react-native command in PowerShell to install materials-kit and vector-icons. The installation of these packages failed and the directory is no longer considered a react-native project directory. I have to reinstall react-native as a result.
How can I install materials-kit and vector-icons without causing the system to uninstall react-native?
Steps Taken
I ran the below code in PowerShell. Please Note: I also used MS Visual Code and the Terminal in MS Studio Code.
Input
npm install -g react-native-cli
react-native -version
Output
react-native-cli: 2.0.1
react-native: 0.59.5
Additional Input
npm install --save react-native-material-kit react-native-vector-icons
react-native -version
Additional Ouput
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory
I was expecting these two react-native packages to be installed. Did not happen.
Extra Information: Error Code Snippet
...
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename
...
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
you have to create a project with the react-native-cli then add your required packages there.
so the steps should be like this:
install the cli tool as you've done it very well.
npm install -g react-native-cli
create a project (you need to provide a name for it).
react-native init *<project_name>*
change your current directory to the created project
cd *<project_name>*
install your favorite packages.
npm install --save react-native-material-kit react-native-vector-icons
run the react-native packager for your target platform (ios or android)
react-native run-ios
or
`react-native run-android`
happy coding!
I solved the program by starting again with no active react-native directory.
1. decided to use Expo to expedite the react-native application set-up process
npm install expo-cli --global
2. initialised new project && changed directory
expo init cra
cd cra
3. installed the react-native material-kit and vector-icons packages individually using yarn instead of npm
yarn add react-native-material-kit
yarn add react-native-vector-icons
4.confirmed installation
Input
react-native -version
Output
react-native-cli: 2.0.1
react-native: 0.57.1