Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clone and run react native projects from GitHub

I am trying to build and run react native application in my phone. I tried with Getting Started and it's working fine. I do the following to run

  1. cd AwesomeProject
  2. react-native start
  3. Open a new tab in terminal
  4. curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"

  5. react-native run-android

and it runs in my android phone.

Now I am trying to run a project from GitHub, I did the following

  1. git clone https://github.com/h87kg/NavigatorDemo.git
  2. cd NavigatorDemo
  3. react-native start

I get Command 'start' unrecognized. Did you mean to run this inside a react-native project? error. What should I do to run this project ? Any help is appreciated. Thanks in advance.

Update

After installing dependencies npm install I am able to run the server. Now when I try to run react-native run-android I get the following error

JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Could not install the app on the device, see the error above.
like image 581
Saahithyan Vigneswaran Avatar asked Sep 20 '16 08:09

Saahithyan Vigneswaran


People also ask

How do you run a downloaded react native project?

Running your React Native application Install 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

Did you install node modules? try npm install

  1. git clone https://github.com/h87kg/NavigatorDemo.git
  2. cd NavigatorDemo
  3. npm install
  4. react-native start
like image 118
Pir Shukarullah Shah Avatar answered Sep 30 '22 06:09

Pir Shukarullah Shah


The problem is that the gradlew file in the android folder isn't executable anymore because you cloned it from a git repo.

Basically, when you do react-native run-android, It does a lot of thing which includs running commands for you such as cd android && ./gradlew installDebug. right there, it tries to execute the gradlew, but can't, cause the file isn't executable. which is why you get that error.

just cd into the android folder, and do chmod +x gradlew.

like image 42
Badmus Taofeeq Avatar answered Sep 30 '22 06:09

Badmus Taofeeq