Error in Phonegap Application: Uncaught module cordova/plugin_list already defined

Gthoma2 picture Gthoma2 · Jan 2, 2014 · Viewed 27.1k times · Source

I have been trying to resolve many issues from having updated from Phonegap 2 to Phonegap 3.3 but I can't seem to fix this one.

I have read from some users that uncaught module exceptions can cause imported plugins to stop functioning. I am having some odd bugs with a local notification plugin so I would like to fix this issue and see if it helps.

Here is the error as it appears in logcat within Eclipse:

[INFO:CONSOLE(79)] "Uncaught module cordova/plugin_list already defined", source: file:///android_asset/www/cordova.js (79)

I know that this is some odd issue arising from the nature of Phonegap 3 (Plugins have been reworked). And I think that the problem lies in importing a cordova_plugins.js script as the top line of that script reads:

cordova.define('cordova/plugin_list', function(require, exports, module) {
module.exports = [
{
    "file": "plugins/org.apache.cordova.file/www/DirectoryEntry.js",
    "id": "org.apache.cordova.file.DirectoryEntry",
    "clobbers": [
        "window.DirectoryEntry"
    ]
}, ...

And this is the only place that I can find the existence of cordova/plugin_list as referenced in the error.

However, I am not sure of the correct way of fixing this issue. I did not use plugman to import my plugins, but instead the CLI commands outlined in the Phonegap 3.3 API

Answer

grytrn picture grytrn · Jan 31, 2014

One cause of this problem is importing the cordova_plugins.js in your html file.

Check if it is the case for you and remove it.