Can't build ng-cordova demo app

I’ve just started learning ionic. I installed cordova, ionic, etc. and built and launched a few sample apps (tabs) etc., so ionic itself is working, I can run the sample apps in the iOS emulator.

Now, I’d like to try ng-cordova, but can’t get it to work.

Here is what I did: I ‘git clone’-d ng-cordova to my computer (Macbook, if that matters), and using the terminal I did the ‘cd ng-cordova/demo/app’, that’s I assume the sample app to try? But when I do ‘ionic platform add ios’, in that directory, it reports an error: ENOENT, no such file or directory ‘…/demo/app/plugins/ios.json’. What am I doing wrong?

Also the readme.md file in the ng-cordova /demo/app directory seems to be wrong, it describes Ionic App Base, not the demo app (unless I’m missing something obvious).

Thanks!

Hey, I didn’t have any problem to make it work.

Just cd to the « app » directory, then run

npm install
gulp install
bower install
ionic platform add android

And then, I installed all cordova plugins :

cordova plugin add https://github.com/wildabeast/BarcodeScanner.git
cordova plugin add org.apache.cordova.camera
cordova plugin add org.apache.cordova.contacts
cordova plugin add org.apache.cordova.device
cordova plugin add org.apache.cordova.device-motion
cordova plugin add org.apache.cordova.device-orientation
cordova plugin add org.apache.cordova.dialogs
cordova plugin add org.apache.cordova.file
cordova plugin add org.apache.cordova.geolocation
cordova plugin add org.apache.cordova.globalization
cordova plugin add org.apache.cordova.network-information
cordova plugin add https://github.com/Paldom/PinDialog.git
cordova plugin add https://github.com/phonegap-build/PushPlugin.git
cordova plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git
cordova plugin add https://github.com/Paldom/SpinnerDialog.git
cordova plugin add org.apache.cordova.splashscreen
cordova plugin add org.apache.cordova.statusbar
cordova plugin add https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git
cordova plugin add org.apache.cordova.vibration
cordova plugin add org.apache.cordova.media-capture

And for android,

ionic build android && ionic run android

Thanks for your help, however I’m still getting the same error. I decided to start from scratch, deleted the ng-cordova directory, and did the following:

git clone https://github.com/driftyco/ng-cordova.git
cd ng-cordova
cd demo
cd app
sudo npm install
gulp install
bower install

All of the above seemed to work ok, no error, but then I issued:

ionic platform add ios

and here is what I got back:

================

Running platform task…
Adding platform ios
Creating ios project…
Error: ENOENT, no such file or directory '/Users/Andrei/Documents/ng-cordova/demo/app/plugins/ios.json’
at Object.fs.openSync (fs.js:432:18)
at Object.fs.writeFileSync (fs.js:971:15)
at Object.save_platform_json (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/config-changes.js:442:8)
at PlatformMunger_process [as process] (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/config-changes.js:367:13)
at Object.exports.process (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/config-changes.js:78:12)
at Object.handlePrepare (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/prepare.js:73:20)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:101:25
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:798:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:827:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:760:13)
Unable to add platform ios. Please see console for more info.

================

This is on a Mac OS X Mountain Lion. What am I missing? Thanks!

Hey again.

Have you tried to install the android one ? I had this error when I didn’t have installed the cordova plugins. Can you try to add them before adding the platform ?

Bingo! After installing the cordova plugins, I was able to add the platform, build and run. Thanks for your help, I would’ve never guessed!

Glad to help :slight_smile: happy ionic !

I’m getting this error now, how do I install the cordova plugins?

Hi,

I thinks you found your answer, but just in case

cordova plugin add <name_of_plugin>

For future reference I added the three default plugins back with these commands:

cordova plugin add org.apache.cordova.device
cordova plugin add org.apache.cordova.console
cordova plugin add com.ionic.keyboard

I’m using window7, and to make it works i need to create manually plaforms and plugins directory inside ng-cordova/demo

1 Like

I’m on OSX Mavericks. I also had to add the two directories “platforms” and “plugins” manually before I could build or emulate. Also, the first time I run emulate, it launches the simulator and then always exits with an error. After that, when the simulator is up-and-running, it works fine every time.

1 Like

hi ,

Did u get ionic run on Windows 7 ? Though i followed steps in the windows inst. tutorial video , i m getting the attached error and i am stuck at that point

image