Clone an existing Ionic project from git


#1

Hi all,

This might seem like a silly question, however I have googled around and the closest to an answer I can find is here: https://github.com/driftyco/ionic/issues/2361. However, this doesn’t really answer my question properly.

So I have an existing ionic project which is commit and pushed to a Git repository. Now on another computer, I have clone this Git repository. If I run ionic serve is runs fine.

However, if I run ionic run android I get this:

No platforms added to this project. Please use `cordova platform add <platform>`.

I understand this is because the platforms are not commited to Git. My question is: is there a way to initialize a project from git so it installs all dependencies etc…?


#2

Add the platform and run the project again, it should work fine!

:smile:


#3

Thanks for the reply flipew. Yes I did this and it works fine. My question is if there is a proper way to initialize a project which sets up all dependencies instead of having to run it each time?

How do I know if there are any other missing dependencies that I might miss?


#4

Well you could add all files in your project but this would require long time especially for node_modules and platforms.

You know it is working when you can successfully build your app with ionic build android or ios.

Follow the instructions of the Apache Cordova docs, ionic adds few things that you should follow too.

Basically, it’s up to the project owner to give these instructions especially for beginners.


#5

What about using hooks?
You can get Cordova to add the platform before building so you don’t get the error again!