Search code examples
gitcordovaionic-frameworkionic2ionic-cli

Cordova/Ionic2 project created from GIT repo


I developed a ionic2 application, I pushed it to a private git repo accessible by our team. When another colleague is downloading this project, he is not able to use the ionic/cordova commands. (he has ionic/cordova installed globally so it's not this problem, I even tried on my machine by creating another repo and didn't work)

Error: Current working directory is not a Cordova-based project.

I know that ionic start/cordova create adds something more than what is uploaded to git, but this commands come with a .gitignore file that will ignore those files.

Is there any way to initiate the ionic application having the code from the private git?

I saw that ionic cli has a command: ionic start --template (which specifies a template) - Starter templates can either come from a named template, (ex: tabs, sidemenu, blank), a Github repo, a Codepen url, or a local directory.

This doesn't work as expected or I am not trying the right way.

Did anyone have the same problem and got a solution?


Solution

  • I found that there is no need to create the www folder and to put it on github.

    The steps for cloning the Ionic2 application from a git repo are the following:

    1. Git Clone
    2. npm install
    3. ionic build (which will create the www folder and the build structure inside it)
    4. ionic platform add <platform>
    5. ionic build <platform>

    It worked for myself, without changing the ionic2 .gitignore or to have a www with .gitkeep as Andreas suggested (which is actually one of the solutions).