Beqa
Beqa

Reputation: 99

Ionic 3 Android build error

I am using Ionic 3. Right now I'm trying to do ionic cordova build android , but I get TypeError: env.runcmd is not a function (please see the photo attached).

the screenshot

I tried to:
-> ionic cordova platform rm android then ionic cordova platform add android then again build android again
-> delete node_modules folder and do npm install then build android again

But none of them helped it...

My ionic info output:
enter image description here

Upvotes: 0

Views: 1615

Answers (2)

Beqa
Beqa

Reputation: 99

Okay, guys, the problem was exactly with cordova version. I haven't noticed when it did update to the version 7.0.1. However, I had to downgrade it to version 6.5.0 and then android build succeeded.

The only thing that confused me was the downgrade process. Every time I did sudo npm uninstall cordova -g, the cordova command was still available at bash. If I would do sudo npm install [email protected] -g, the version still remained 7.0.1. Even some other commands such as ... --save --save-exact ... did NOT work.

So below are the steps which I've gone through to solve this issue (I am using Ubuntu linux, so this will work for linux users only).

First I uninstalled cordova through npm
sudo npm uninstall cordova -g

Then removed the program from local bin
sudo rm /usr/local/bin/cordova

Installed the specific version of cordova
sudo npm install [email protected] -g (or whatever version you want)

And lastly, I have to admit that after cordova installation, it was now located at /usr/bin/cordova, no more at /usr/local/bin/cordova, so I had to create a hard link to it.
sudo ln -s /usr/local/bin/cordova /usr/bin/cordova

Voilà!

Upvotes: 0

Just use command 'cordova run android' instead of 'ionic cordova run android'.

Upvotes: 1

Related Questions