Build existing ionic project


#1

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.


#2

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


#3

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.


#4

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.)


#5

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?


#6

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.


#7

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

System:

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

Misc:

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.


#8

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


#9

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.


#10

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.


#11

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


#12

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.


#13

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.


#14

Inside platform_www folder:
platform_www

So it not an ionic project?


#15

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.