react-native: [cli] Command `run-android` unrecognized.

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

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 11
  • Comments: 34 (2 by maintainers)

Most upvoted comments

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

@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.

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

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: https://github.com/facebook/react-native/commit/373c8777f6bad3a935089bd4c59bf2e15896de63.

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.

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.

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

yep “npm install” fix the problem

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

miss node_modules directory

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!

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.

@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 !