Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native run-android is unrecognized

I've installed react-native-cli globally:

npm install -g react-native-cli 

Then run:

react-native init AwesomeProject cd AwesomeProject 

I got the following structure:

-- AwesomeProject    ---- node_modules       ------ react-native     

When I run react-native run-android I get an error:
Command run-android unrecognized. Did you mean to run this inside a react-native project?

When I run react-native start I get the same.

react-native -v
prints:
react-native-cli: 0.2.0
react-native: n/a - not inside a React Native project directory

What I'm doing wrong?

like image 420
Sergey Onishchenko Avatar asked Jun 03 '16 11:06

Sergey Onishchenko


People also ask

How do I install React Native in Windows 10?

Get started with React Native by installing required toolsInstall Visual Studio Code (or your code editor of choice). Install Android Studio for Windows. Android Studio installs the latest Android SDK by default. React Native requires Android 6.0 (Marshmallow) SDK or later.

How do I start React Native project?

Running your React Native applicationInstall the Expo Go app on your iOS or Android phone and connect to the same wireless network as your computer. On Android, use the Expo Go app to scan the QR code from your terminal to open your project. On iOS, use the built-in QR code scanner of the default iOS Camera app.


2 Answers

What caused this for me was running npm install --save [package] when actually the system has previously been using yarn instead of npm.

To solve this I just deleted the node_modules folder and ran: yarn install and after that react-native run-ios (or android) works fine.

(This is a duplicate of React Native: Command `run-ios` unrecognized)

like image 186
Dimitris Avatar answered Sep 23 '22 07:09

Dimitris


I just ran "yarn" with no arguments and it fixed it.

like image 22
Doug Voss Avatar answered Sep 25 '22 07:09

Doug Voss