Error occurred trying to fall back to Cordova-lib execution

I found a fix. I’m on mac. so sudo is a must to install npm -g packages unless you do this: http://www.johnpapa.net/how-to-use-npm-global-without-sudo-on-osx/. The issue doesn’t seem to be with sudo though.

Looking into /usr/local/lib/node_modules/ionic/lib/ionic/cordova.js:296 code made me realize that ionic throws this error when it can’t find cordova-cli. Then, running ionic info showed Cordova CLI: Not installed. Although I installed cordova and its in standard npm path, ionic didn’t pick it up. Looking around showed that ionic works well with cordova@4.2.0.

sudo npm install -g cordova@4.2.0
ionic info > it should show Cordova CLI: 4.2.0
ionic build android

This time it worked!

3 Likes