[ 
https://issues.apache.org/jira/browse/CB-10284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15090992#comment-15090992
 ] 

Sebastien commented on CB-10284:
--------------------------------

OK so I managed to reproduce the issue.

- I have both [email protected] and [email protected] CLIs globally installed
- I start a new Ionic project like so `$ ionic start cordova-issue`, note that 
the project is created using [email protected] this way
- I `$ cd cordova-issue && subl .` and change to content of the project 
_package.json_ file to be:

{code:javascript|title="package.json"}
{
  "private": true,
  "name": "cordova-issue",
  "version": "1.0.0",
  "scripts": {
    "postinstall": "rm -rf platforms plugins && ionic state restore",
    "start": "npm install && ionic run android --device"
  },
  "devDependencies": {
    "cordova": "5.4.1",
    "ionic": "1.7.12"
  },
  "cordovaPlugins": [
    "[email protected]"
  ],
  "cordovaPlatforms": [
    "[email protected]"
  ]
}
{code}

- I also edit the _www/index.html_ file to add `<script 
src="https://code.jquery.com/jquery-2.2.0.min.js";></script>` just before 
`</head>`
- Then I hook up an Android device, run `$ npm install && ionic run android 
--device` and use Chome for remote debugging the application
- jQuery failed to load (_Failed to load resource: the server responded with a 
status of 404 (Not Found)_) even if `<access origin="*"/>` is present in 
_config.xml_

Now I see what I did wrong: my `postinstall` NPM script uses the locally 
installed [email protected] CLI to rebuild the _platforms_ and _plugins_ 
directories but then I run the application using the globally installed 
[email protected] CLI so no surprise plugins don't load. If I just run `$ npm 
start` everything works as expected using [email protected] all the way through.

My bad!

Maybe some kind of solution here would be to warn the developer that there is a 
version mismatch that could lead to issues like this one :)

Thanks


> Adding plugins seems to be totally broken on Cordova 5.4.0 and 5.4.1
> --------------------------------------------------------------------
>
>                 Key: CB-10284
>                 URL: https://issues.apache.org/jira/browse/CB-10284
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: CordovaLib
>    Affects Versions: 5.4.0, 5.4.1
>         Environment: Mac OS X 10.10.5
>            Reporter: Sebastien
>            Assignee: Vladimir Kotikov
>            Priority: Minor
>              Labels: triaged
>
> Using Cordova CLI 5.3.3, try creating a new project and then adding the 
> Android platform and the whitelist plugin (using `$ cordova plugin add 
> [email protected]`). Then open the _plugins/android.json_ file, 
> its content is:
> {code:javascript|title=plugins/android.json}
> {
>     "prepare_queue": {
>         "installed": [],
>         "uninstalled": []
>     },
>     "config_munge": {
>         "files": {
>             "res/xml/config.xml": {
>                 "parents": {
>                     "/*": [
>                         {
>                             "xml": "<feature name=\"Whitelist\"><param 
> name=\"android-package\" 
> value=\"org.apache.cordova.whitelist.WhitelistPlugin\" /><param 
> name=\"onload\" value=\"true\" /></feature>",
>                             "count": 1
>                         }
>                     ]
>                 }
>             }
>         }
>     },
>     "installed_plugins": {
>         "cordova-plugin-whitelist": {
>             "PACKAGE_NAME": "com.my-app.dev"
>         }
>     },
>     "dependent_plugins": {}
> }
> {code}
> Now start another project using Cordova CLI 5.4.0 or 5.4.1 and do the same 
> exact thing. The file content is:
> {code:javascript|title=plugins/android.json}
> {
>     "prepare_queue": {
>         "installed": [],
>         "uninstalled": []
>     },
>     "config_munge": {
>         "files": {}
>     },
>     "installed_plugins": {
>         "cordova-plugin-whitelist": {
>             "PACKAGE_NAME": "com.my-app.dev"
>         }
>     },
>     "dependent_plugins": {}
> }
> {code}
> Notice that `config_munge.files` is empty. This is a major regression as 
> plugins using this feature don't work at all sometimes even preventing the 
> `deviceready` event to be triggered.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to