Closed ferreiro closed 6 years ago
I think this may just be an issue with an outdated version of cordova-browser. Just tried this on my machine and didn't see any problems. Could you try removing the browser platform and using the latest version, phonegap platform add browser && phonegap platform add browser
.
Hi @surajpindoria! Thanks so much for getting back to me.
Yes, it worked to remove browser platform and add it again. I think there is a problem with phonegap templates generator, which installs old or corrupted browser version. Problem solved! Thanks!
Great that you got it solved!
And I think what happened is you may have ran phonegap serve
which auto-adds the latest browser platform. But then as we updated the CLI tooling it required a newer version of the platform which is why you were seeing those errors.
@surajpindoria hmmm. Actually I don't use phonegap serve
command. Instead, I used Phonegap 2 mac application (for creating the project and also launching the server). So what's happening in this case?
The PhoneGap Desktop app is still using phonegap serve
behind the scenes. So it is adding the browser platform as well.
Ahh! Okey! Thankx
Just wanted to say that this still happens if you run a project from Phonegap Desktop, then afterwards try to install a plugin.
The advice above also has a typo, people who have this issue must run this from the CLI:
phonegap platform rm browser && phonegap platform add browser
(above text has "add" twice instead of "rm")
how solve this so? i want install admob plugin but cannot find: platforms\browser\cordova\api.js
I try with
phonegap platform rm browser && phonegap platform add browser
but dont works
Try separating the commands.
For example, do this one first: phonegap platform rm browser
After the above executes do this one: phonegap platform add browser
It did work, but when I run the app, I get this errors
cordova.js:1534 GET http://10.0.0.1:3000/cordova_plugins.js 500 (Internal Server Error) exports.injectScript @ cordova.js:1534 injectIfNecessary @ cordova.js:1542 exports.load @ cordova.js:1622 (anonymous) @ cordova.js:1142 setTimeout (async) (anonymous) @ cordova.js:1141 build @ cordova.js:51 require @ cordova.js:66 (anonymous) @ cordova.js:1861 (anonymous) @ cordova.js:1863 (index):1 Refused to execute script from 'http://10.0.0.1:3000/cordova_plugins.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Your CSP is preventing you from running something with MIME type of 'text/html', but why is that script being served as that mime type instead of text/javascript
is another issue.
Finally found it, I had a very similar issue with android. Before this message I had to install several npm modules:
npm i q properties-parser cordova-common shelljs
PhoneGap CLI, node & npm versions
Node: v8.5.0 Phonegap: v7.1.1 npm: v5.3.0 macOS: Sierra 10.12.6
Expected Behaviour
When running the command
$ phonegap plugin add plugin-name
it installs correctly the plugin (including all the platform dependencies and needed assets).Actual Behaviour
Phonegap CLI fails to install new plugins, because the browser platform is missing API.js.
Steps to Reproduce
$ phonegap plugin add cordova.plugins.diagnostic
Error messages