[Solve]Cordova plugins undefined with Ionic

“Cordova plugins undefined with IONIC framework”

This post is to sort out a particular problem about when the ionic project starts running, there is an error message, said “Cordova plugins is undefined”.

I searched over google, really cant find a good solution for it. People suggested to delete the plugin and reinstalled, which does not work for me. Look other people’s work, make me headache. I was trying to write information on the file which store in the cordova file system. I followed the documentation on Ionic to add “cordova-plugin-file”

$ ionic plugin add cordova-plugin-file

After type that in terminal, I supposed my ionic app knows where the plugin goes. However, it does not add in my app.

What I did was look through folders and find where to store plugins for the app.

It is in package.json in the project. And then you find Cordova plugin, there are a list of plugins for your project. Add

$ Cordova-file-plugin

into the “cordovaPlugins” list. package.json Picture

Save the file.

Run and build ionic project in terminal to open the simulator. I guess everytime I add a plugin for the project, I have to add manually in package.json as well.

I hope this can help you. Because I have spent a lot time try to figure out what’s wrong with my code. And surprisingly, there is not a single documentary dress that.

Ting Chen

Everything happens for a reason!

contact@ting-chen.com Glasgow, UK