0

I learning React-Native with Windows 10, Using Git Bash Command Prompt and Android Studio Emulator.

I have Install React Native globally by using npm install -g react-native-cli, I always create Project using react-native init ProjectName and

My Project Launching Method is

go into Project Directory with Git Bash CMD and execute react-native run-android.

I notice that most of the Project in Github are older version which consist of index.android.js and index.ios.js (My Project is newer version so it only have index.js). I been trying to open some older version Project, but it seem like it just does not launch with the method I mentioned above.

I also have tried react-native start method from How to open existing project in React Native? but I still not able to launch it.

The error message when I trying to launch the project is Command unrecognized. Make sure that you have run npm install and that you are inside a react-native project. This Problem only occur when I trying to launch project from Github, when I open my own Project there is no such problem.

ps. If I try use npm install in the project directory, it will have some error.

enter image description here

I have try to search from Net, most of their launching method are the same as above and does not work for me, so wanna ask that:

  1. Is my method of launching React-Native is wrong in the very beginning?
  2. Is there anything I need to install so that I can open old version React Native Project?
  3. How can I open this project with my current situation? https://github.com/parkerdan/SampleNavigation

Thank you.

Extra Info (React Native CLI and Node Version):

$ react-native -v
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory

> process.version
'v8.9.4' (Node Version)
I am a Student
  • 1,570
  • 4
  • 21
  • 36

2 Answers2

1

After whole day of Searching, I have found the Solution.

Whenever open any Project from Github or any sources, we have to ensure that the we have install all the required Dependencies, as Most of the Project using different type of dependencies that you may have not ever install.

Solution:

  1. Download project

    git clone https://github.com/parkerdan/SampleNavigation.git

2. Go to the Project Directory and Install dependencies (IMPORTANT)

Note: For unknown reason, npm install does not work

npm i 

or yarn i

  1. Run Project (or any launch method that work you)

    react-native run-android

I am a Student
  • 1,570
  • 4
  • 21
  • 36
  • I wonder what is the diff between yours and mine? anyway, nice to have a problem solve :D. Good luck with react-native – Khoa Mar 15 '18 at 08:37
  • seem like npm install does not work for some reason @.@ it will pop out error in my question above, however npm i work well without pop out any error. I not really sure what the problem though. ps. just realised npm install and npm i are the same thing. – I am a Student Mar 15 '18 at 08:39
  • @IamaStudent please use yarn install and let me know if you're still facing this issue – Muhammad Umair Ghufran Sep 23 '18 at 15:12
0

After you clone your project from git and cd to project folder, make sure you run npm install before you can react-native run-android.

Khoa
  • 2,632
  • 18
  • 13
  • use the npm install in the Project Directory? I have tried npm install in the downloaded project directory and it will always prompt error, maybe I will include the error in my question, i edit it now. – I am a Student Mar 15 '18 at 07:42
  • could you provide some info about your node version & react-native-cli version? – Khoa Mar 15 '18 at 07:51
  • Updated, and what do you mean by 'Clone Your Project from Git'? – I am a Student Mar 15 '18 at 07:58
  • `clone` is the term for getting project from git to your machine. With the github link you gave above, here is its cloning: `git clone https://github.com/parkerdan/SampleNavigation.git` – Khoa Mar 15 '18 at 08:11