Ionic Build - but which project?


I’ve just really confused myself. I have a project on my desktop that builds and runs great. I added another in a different directory, did an Ionic Start App2 Tabs, and it produced most of the files I need but no plugins or platforms directories.

I tried to add a platform, said it was already added. I did a build, and it built my first app for me, although I ran the build from the root of the second app.

I think it’s one of two things, my environment is set up wrong, or I haven’t grasped ionic / cordova properly.

Can anyone advise please?

Thank you and happy new year :smile:

Have you navigated into the right project ?

If you are working on a project your are within that project directory.

If you want to create a new project make sure you change directory. other wise your new project will be created in that directory. you will have project win a project. In this case your have change directory into the new project. But i am pretty sure this is not how you want your projects be embedded into each other.

When you creating new project make sure your have changed directory.

Let me know if it doesn’t make sense

Hi Cmaden, thanks for your help.

That makes perfect sense, which is why I have no idea why it’s behaving like this :smile:

I started with 1 app, everything behaved. When I first ran ionic platform add android from the root of App1 it created a platforms directory at the same level as www. I thought the platforms/build would then be specific to each app.

I created a second app, and it generated something like this

Desktop -
– App1
– App1 - Main
– App1 - Main - www
– App1 - Main - platforms
– App1 - Main - plugins (etc)
– App2
– App2 - Main
– App2 - Main - www
– App2 - Main - plugins (etc)

Once my second app was created I did a cordova platform add android and it claimed it already existed. It’s still working from my App1 setup.

I can run ionic build from ANYWHERE (e.g. directly on my desktop) and it builds App1, even doing it from the root of App2.

I must have fiddled with Ionic build or something and fixed the directory. I have looked through my environment variables and no suspects. Maybe I should reinstall ionic with NPM.

I’m going to put a clean dev build on my friends PC tomorrow so I will see if that has the same odd behaviour, and then try and work my way back.

As soon as I know how I’ve screwed this up I’ll post up. Thanks for letting me know this ISN’T the expected behaviour :smile:


if you not within a cordova project you get the following error.

current working directory is not a cordova-based project

double check your current directory you running your commands from.


Yeah I wouldn’t get that error, regardless of where I ran Ionic.

I have found the problem, it was my configuration of the Windows 8.1 command prompt. I had set it to auto run a change directory to the root of my App1 project, this saved me some navigating. To do that I edited the registry

[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
“Autorun”=“cd /d %App1%”

Where %App% is the root of my App1 project. For whatever reason, even having navigated away from there it still behaved as if it were in App1.

I have removed this and now I can run from the root of both apps. However it still doesn’t error if I run from a non project directory, just fails silently.

This is a step forward anyway :smile:


Ahhh, Ionic Platform List will throw the “current working directory is not a cordova-based project” error for me if I’m not in the right place, so I think it’s back to normal.


No worries, gladd you solved it now.

Good Luck