Adding plugins to Ionic 2

In the current app I am building I need to use the network information plugin so to add it I ran the command:

ionic plugin add cordova-plugin-network-information

In my Ionic 1 apps I always used ionic plugin add to add my plugins as the plugin is then automatically added to the package.json file (which I assumed was good).

Anyway, after adding the plug-in (and without adding any code to actually use it) I built the app and tested it on a device. The app crashed on loading (no errors in the log – just crashed on startup). I removed the plugin and added it again and re-tested. Same thing happened.

Then I tried removing the plugin and adding it back again but this time using:

cordova plugin add cordova-plugin-network-information

This time when I built the app, it worked.  I thought the only difference between the ionic plugin command and the cordova plugin command was the entry in package.json but presumably there are other differences?   Changing to the cordova command also appears to have helped someone else so its not just me.


I’m a mobile applications developer based in the UK, concentrating primarily on hybrid application development with Ionic and Ionic 2 but also with native development skills. Please visit for more information about me and how I may be able to help you with mobile application development, particularly with Ionic 2 but also with other mobile frameworks and technologies.  Thanks for visiting.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s