When running
cordova plugin add cordova-plugin-inappbrowser
I always get the following errors:
Fetching plugin "cordova-plugin-inappbrowser@~1.2.0" via npm
Installing "cordova-plugin-inappbrowser" for ios
Failed to install 'cordova-plugin-inappbrowser':undefined
Error: Expected "*/" or [^*] but "*" found.
Many of the infos I found are far outdated. I have:
[email protected]
[email protected]
Here are a few different ways you can go about fixing your issue:
1. Check if everything is generating as it should and clean your project.
Sometimes by logging things and looking at output package you can find that plugin installation is not always reliable. In some cases a couple of plugins might fail to install properly (where you see a "not defined" messages and possibly your
undefined
message in your logs). Usually removing and (re)adding the failing plugin can fix this issue. Another thing to try is cleaning the project before doing a build - both iOS and Android have a cleanup script available in either./platforms/ios/cordova/clean
and./platforms/android/cordova/clean
respectively which can help sometimes when run between builds.You can get these bad/incomplete installs sometimes if you have a bad wifi connection. You can test this by checking you the folders thenselves and the
plugins/fetch.json
,plugins/ios.json
andplugins/android.json
files.Your
plugins/fetch.json
should look like this:When you run
cordova build
orcordova prepare
it should autogenorate a.json
for each platform you project has so if you have android and ios it sould create aandroid.json
&ios.json
and that should look like this:here try removing the projects build then build it again
Now test your project, if no luck try some of the following steps.
2. Remove and (re)add your projects
platforms
andplugins
folders.in base of your apps folder run
Now test your project if not try steps 3 & 4
3. Test if running
cordova plugin add cordova-plugin-inappbrowser
will work correctly when in a new projectTry running:
If it installed into the new project correctly go into the
plugins/
folder then drag and drop thecordova-plugin-inappbrowser
plugin folder into your current projectsplugins/
folder then test your project again, if your still having an issue double check the make sure thefetch.json
orios.json
/android.json
files are genorating correctly and they look something like what's in #1.Also assuming the plugin works in your new app and the new app is using the same app name and package name (when you ran
cordova create hello com.example.hello "HelloWorld"
) you can also simply replace your currentwww/
in the new project and run it and you shouldn't run into any problems.4. Similar to step #3, download the plugin not using the
cli
then add it to your projectTry downloading the .zip file for the plugin here https://github.com/apache/cordova-plugin-inappbrowser and add it to your
plugins
folder then test your project5. Update your project and cli
Try to be on the current 4.1.0 for ios so in your project folder try running
You can also change your projects version (
cordova-ios
orcordova-android
) versions by specifying in yourplatforms/platforms.json
e.i.
Although it is the current version and will hopefully be issue free I have ran into a plugin issue with this where I am currently using a lower version, so if you are still having issues try again with with version
@4.0.0
or@3.6.3
you can do so with some of the other useful commands I have provided under #66.Make sure you have the right permissions
There is also a chance you could be having a cordova permissions issue so try checking or changing the following locations
run:
to find your user name, use that name here:
ie
and your project folder, assuming its on the desktop and named ExampleProject
Other Useful commands
in your apps root folder you can try some of the following
to see the plugins in your current project
to check what platforms version in you current project run
or
It will give you the following output
check the current platform version of a cordova app
to update your existing version
to change projects version first install globally with the version you'd like then add it to your project
or to update to a specify a specific version
to see the currently running cordova version on your machine run
for more detail run
Addition notes:
When you add
cordova
plugins they are plugins meant for the device and not the browser so make sure you testing on a device by appending --device to your run command like socordova run ios --device
The old cli you would add plugin with a
.
syntax ieorg.apache.cordova.inappbrowser
now you don't, so make sure you are using-
's like you where doingcordova-plugin-inappbrowser
UPDATE: I just read your comment where you said it it works in a different project. I don't know much about http://www.macincloud.com/ but it looks like your problem is an issue from the initial install of the plugin so try cleaning it or remove and adding it back like in step 1 and 2