Skip to content

[cli] Command run-android unrecognized. #2880

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xinthink opened this issue Sep 20, 2015 · 34 comments
Closed

[cli] Command run-android unrecognized. #2880

xinthink opened this issue Sep 20, 2015 · 34 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@xinthink
Copy link
Contributor

I'm following the quick start guide to create a RN app, but got the error message:

Command `run-android` unrecognized. Did you mean to run this inside a react-native project?

and the command react-native android is also unrecognized.

Environment:

  • node v4.0.0 (npm v2.14.2)
  • RN v0.11.0
@shinriyo
Copy link

thank you react-native android command was fine

@codingwithus
Copy link

same issues happens to me also

@pcqpcq
Copy link

pcqpcq commented Sep 22, 2015

copy directory "node_modules" to my project fixed.
you can find "node_modules" in demo project.

so i guess we should run "react-native init" or "react-native android" first.

@mkonicek mkonicek self-assigned this Sep 24, 2015
@mkonicek
Copy link
Contributor

Did you change to your app's folder? Just updated the Getting Started guide to make this clearer:
https://github.com/facebook/react-native/blob/master/docs/GettingStarted.md

@pcqpcq
Copy link

pcqpcq commented Sep 25, 2015

i don't think what you have updated is useful to this issue
a0ccebc#diff-c427a522f4ea08a4c045a518ac721ce9

@xinthink
Copy link
Contributor Author

Thanks @pcqpcq, changing directory did fix my problem.

@mbylstra
Copy link

mbylstra commented Oct 2, 2015

If you are using a version of react-native-cli less than 0.12, any error will get swallowed and you'll see the error "Command run-android unrecognized", regardless of what the actual error is. In my case, I was running the command from the correct directory, but lodash had somehow gotten into a corrupt state. Doing npm uninstall lodash and npm install lodash fixed the problem for me.

The react-native-cli in v0.12.0-rc will not swallow errors: 373c877.

What I did was hack my installed version of react-native-cli (found using which react-native) so that the error is logged to the console.

@deeppatidar
Copy link

Command run-android unrecognized. Did you mean to run this inside a react-native project?
Getting same issue i have tried all possible stuff but still doesn't working even android command also not working

@9mm
Copy link

9mm commented Nov 22, 2015

Im getting same thing... it's on an existing project that I just did a fresh npm install on. It worked before, so maybe an updated package broke it?

@bmichal
Copy link

bmichal commented Feb 7, 2016

Had the same issue, it turned out I did not have /node_modules directory inside.
Runningnpm install solved the problem.

@windmxf
Copy link

windmxf commented Feb 18, 2016

miss node_modules directory

@gathole
Copy link

gathole commented Feb 25, 2016

I am learning react native and Trying to run this project https://github.com/FaridSafi/react-native-gifted-messenger

but all the time getting the error

gathole$ react-native run-android
Command `run-android` unrecognized. Did you mean to run this inside a react-native project?

Can someone please help me out to run this project???

@FrancisShi
Copy link

yep "npm install" fix the problem

@vhrv
Copy link

vhrv commented Apr 9, 2016

same issues happens to me also

@MayeuldP
Copy link

@vhrv Did you try 'npm install' and after that 'react-native run-android' ? Same issues for me and this, fix the problem. Maybe be patient, because 'npm install' was a bit long !

@yashvekaria
Copy link

yashvekaria commented Apr 12, 2016

For Linux Users

Your app is not getting the path of android-sdk, so If you are using linux (ubuntu), than you need to add a file named "local.properties" and save it inside the android folder, which is created inside your app folder.

You need to add below line inside local.properties file, which is the path of your android-sdk lies inside your system inside system in order to run the app.

sdk.dir=/opt/android-sdk/

save and rerun the command react-native run-android

OR

you can open terminal, type

sudo nano ~/.bashrc

and paste the below path at the end of the file

export ANDROID_HOME="/opt/android-sdk/"

and restart your computer and run again react-native run-android after that.

Note:- If you put set path in .bashrc file, then you don't even need to create local.properties file.

@uriklar
Copy link

uriklar commented Sep 1, 2016

I was receiving the error:
Unrecognized command 'run-andriod'

I followed this guide but I put the line:

# If you installed the SDK via Homebrew, otherwise ~/Library/Android/sdk
export ANDROID_HOME=/usr/local/opt/android-sdk

in my .bash-profile file. When I put it in .bashrc file (and restarted terminal) the command react-native run-andriod worked.

@noopesh17
Copy link

I am was outside the project while running 'run-android' command. I just navigated to to project by below command:
cd AwesomPoject

And then run the command. It worked like a charm.

@Gapur
Copy link

Gapur commented Mar 3, 2017

Are you sure that the correct directory? Look at directory of project.

@marcellodesales
Copy link

So, I still can't get it to run... I'm trying to bootstrap it from a Docker image https://github.com/MaximeD/docker-react-native#get-image

dev@kauai:~/app$ echo $ANDROID_HOME 
/usr/local/android-sdk-linux

dev@kauai:~/app$ react-native run-android
Scanning 2 folders for symlinks in /home/dev/app/node_modules (0ms)
Android project not found. Maybe run react-native android first?
dev@kauai:~/app$ react-native android    
Scanning 2 folders for symlinks in /home/dev/app/node_modules (0ms)

  Unrecognized command 'android'
  Run react-native --help to see list of all available commands

However, I do have the command android...

dev@kauai:~/app$ which android
/usr/local/android-sdk-linux/tools/android

dev@kauai:~/app$ android version
Error: Expected verb after global parameters but found 'version' instead.

       Usage:
       android [global options] action [action options]
       Global options:
  -h --help       : Help on a specific command.
  -v --verbose    : Verbose mode, shows errors, warnings and all messages.
     --clear-cache: Clear the SDK Manager repository manifest cache.
  -s --silent     : Silent mode, shows errors only.
...
...

@manjeets12
Copy link

ok if you have configured your project or machine with yarn and used npm install in your project than your project will break with the same error.
solution - delete node_module flder
than use yarn install followed by react-native run-android

@doukasd
Copy link

doukasd commented Jun 30, 2017

@manjeets12 exactly, my issue is that I had used npm install.

Deleting the node_module folder and running yarn install fixed the error for me.

@mad0ba
Copy link

mad0ba commented Jul 6, 2017

Had the same issue but then i came across this solution to run yarn add react-native-cli.

@Abydars
Copy link

Abydars commented Aug 31, 2017

use yarn instead of npm

@bimix
Copy link

bimix commented Sep 19, 2017

using just Yarn command fixes it but unfortunately i have to do it always when i run the emulator and it takes time!

@slesulvy
Copy link

@doukasd Thank you

@alexandre-thauvin
Copy link

I am the same issue that all...

I'm on the correct directory (root of my project, the node_modules folder is here).
I added the export in my bashrc
I deleted the node_modules folder and I used yarn install and run "react-native run-android" and "react-native android" ...

@luizvidoto
Copy link

luizvidoto commented Jan 8, 2018

Delete node_modules folder and run these two commands worked for me!!
yarn install
yarn add react-native-cli

@doukasd @Mardii-D-King thank you!

@fuyue111
Copy link

I had the same issue when i installed react-native-action-bar, maybe the installed package broke it.
Running npm install solved the problem.

@kanhaiya8542
Copy link

navigate the proper path to run this command - *react-native run-android *

@pankajnvhatkar
Copy link

npm uninstall lodash and npm install lodash fixed the problem for me

@serzahke
Copy link

make sure about the android studio or other emulator be opened, when execute this common:
react-native run-android

@montao
Copy link

montao commented May 6, 2018

This is preposterous. react-native cannot call itself a mature project when it uninstalls itself and mutates into corrupt state.

@samkaraca
Copy link

You may also be in the wrong directory. Be sure you're in main directory.

@facebook facebook locked as resolved and limited conversation to collaborators Jul 21, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests