Build existing ionic project

An Android project is given to me by a client which I assume is done in ionic v1. I am asked to generate an APK file and build the code. I followed the steps given in ionic documentation to set up my system to build an ionic app but I am unable to build the project. I am getting the following message:

Here is a screenshot of the project structure. The client does not seem to have access to the original developer any longer. I am completely new to ionic. One of my colleagues guessed that it could be an ionic v1 project. If anyone knows what it could be then please help me build the APK.


You are running an old version of Ionic CLI.
You should update this, then run ionic info to get the correct project information.

ionic info:

Your system information:

ordova CLI: 6.4.0
Ionic Framework Version: 3.9.2
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v8.11.3
Xcode version: Not installed

This is what I get. I am unable to update my ionic cli.

Well, Ionic CLI 2.1.18 is old and unsupported.
You should update it to get a current environment that is able to build any kind of Ionic app.

(Back with Ionic CLI 2.x the command was ionic build, not ionic cordova build I think - as the error message also tells you by the way.)

I tried to update Ionic CLI using command npm install -g ionic@3.20.0 but CLI doesn’t update.

I also tried to update NPM first using npm install -g nmp@latest. Nothing changes.

Anything else am I missing?

First run npm uninstall -g ionic, then just npm install -g ionic.

That should install a current version. If it does not, please post the complete output of these two commands so we can start debugging.

I managed to update the CLI. I deleted ionic files from AppData folder as give by the response of following command.

C:>where ionic

This the response of ionic info after the reinstallation:
cli packages: (C:\Users\Administrator.Dryad\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0


Node : v8.11.3
npm  : 6.1.0
OS   : Windows 10


backend : pro

When I try to run ionic build android, I get following error:
[ERROR] Sorry! ionic build can only be run in an Ionic project directory.

Now that you have Ionic CLI 3.x, you can use the current command: ionic cordova build android.

You need to navigate to your ionic project folder first. You can do this by running cd "path of your ionic project"
Then you should be able to build it.

Does not work :frowning: I am inside my project directory. still it says :
[ERROR] Sorry! ionic cordova build can only be run in an Ionic project directory.

Then you are not running the command in the Ionic project directory. ionic info should work and output useful things in that directory.

I am running it from the same directory as shown in the screenshot. It does not have www directory though. This is all is given to by my client.

Oh, I didn’t even see that.

That doesn’t look like a Ionic project. It is a Cordova Android project probably.
What does platform_www look like?

With this kind of project you just open it in Android Studio I guess and try to build there.

Inside platform_www folder:

So it not an ionic project?

Not from what you have shown in screenshots for now.

The ionic info had a Framework version, but I have no idea where that was coming from. Certainly not from the folder structure you posted as it doesn’t even have a package.json where ionic info reads most its information.