The plugin command has been renamed - geolocation

After installing Ionic last version 3.1.2 I tried to add the Native Geolocation plugin and I got the following:
ionic plugin add cordova-plugin-geolocation
The plugin command has been renamed. To find out more, run:
ionic cordova plugin --help
I will appreciate any help on this.
Thanks in advance

According to the docs, the command for ionic cli version 3 is:
ionic cordova plugin add cordova-plugin-geolocation

Related

Cordova 8 + iOS 4.5.4 = cannot find module "../cordova/platform_metadata"

Since the latest update to v8 of Cordova, I cannot build anything on Mac.
I always get
(node 626) UnhandledPromiseRejectionWarning: Error: Cannot find module '../cordova/platform_metadata'
I tried what was suggested in this post but I get the same error.
I then did a verbose and it seems like the plugin required to build for ios is not working well
Executing script found in plugin cordova-plugin-swift-support for hook "after_prepare": plugins/cordova-plugin-swift-support/src/add-swift-support.js
Resolving module name for cordova-lib/src/cordova/platform_metadata => ../cordova/platform_metadata
(node:599) UnhandledPromiseRejectionWarning: Unhandled promise rejection
(rejection id: 1): Error: Cannot find module '../cordova/platform_metadata'
(node:599) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.
This was a bug in cordova-plugin-add-swift-support, just update it to latest version (1.7.1)
cordova plugin rm cordova-plugin-add-swift-support
cordova plugin add cordova-plugin-add-swift-support
you need to downgrade cordova 7.1.0 until this issue is fixed. Do this:
npm uninstall -g cordova
npm install -g cordova#7.1.0
cordova platform remove ios
cordova platform add ios
If your running an ionic project that requires the swift plugin you'll need to add the --force flag:
ionic cordova plugin rm cordova-plugin-add-swift-support --force
Then run:
ionic cordova plugin add cordova-plugin-add-swift-support
That just happened to me (using Ionic). In Ionic, the issue comes from a plugin or node_module that is still using cordova/platform_metadata, which is deprecated.
If you are using Linux, in your project directory, try this in the command shell:
grep -iRn 'platform_metadata'
In my case, it was the plugin cordova-plugin-add-swift-support that was still using that, and I wasn't even using that plugin my project, so I deleted it manually. Problem solved. The issue seems to arise when a plugin is calling a module that no longer exists, so you have to either remove that plugin or update it.
With Ionic 3 and Cordova 8.0.0 project.
Here are steps
ionic cordova platform remove ios
ionic cordova plugin rm cordova-plugin-add-swift-support
ionic cordova plugin add cordova-plugin-add-swift-support
ionic cordova platform add ios
I have faced same problem, then upgraded Cordova to 7.1.0 work for me
From my ionic project I did (bash):
grep -r 'platform_metadata' .
and found I had a plugin called cordova-plugin-swift-support was the culprit. I removed it and then added cordova-plugin-add-swift-support back in, and everything worked fine with cordova 8.0.0

ionic: add own cordova plugin

I modified an existing cordova plugin and want to integrate it now into my application.
I already created a link to my source directory
cordova plugin add --link ~/path/to/plugin
but now I can not find my plugin in my project. I suggest, that the plugin needs to be build?
Is it needed to modify my package.json?
Add the plugin to project:
ionic cordova plugin add [plugin]
Documentation
Install and save the plugin:
npm install --save [plugin]
Example
This is related to stackoverflow/questions/30345035
Since you modify existing plugin there is possibility that you didn't modify it right. Also there is possibility that plugin is not working for specific platform version.
If you are looking to add your own cordova plugin in Ionic v2 here can be your solution.
If you have exported your module / plugin like
module.exports = new YourPluginJavaClass();
then you will be able to use it in your Ionic application as
(window as any).YourPluginJavaClass.yourFunction();
Please see this link as well
Hope this helps.

Ionic Platform Add IOS

when I try to add platform ios to my current ionic project the following problem is occurred to me:
Installing "cordova-plugin-whitelist" for ios
Plugin doesn't support this project's cordova-ios version. cordova-ios: 3.9.1, failed version requirement: >=4.0.0-dev
Skipping 'cordova-plugin-whitelist' for ios
How to solve the problem above? What should I do for it?
When I was reading the Ionic docs, I saw a section about Cordova which is called "Cordova Updates". So...when you get an error, a good practice is to search at the official documentation - it might be helpful.
Cordova Updates
$ sudo npm update -g cordova
In your case:
$ cordova platform update ios
Hope it helps.
$ cordova plugin rm cordova-plugin-whitelist
$ cordova plugin add cordova-plugin-whitelist#1.0.0

Error 404: cordova-plugin-file when trying to install cordova-plugin-zip for iOS

When trying to install the cordoba-plugin-zip using:
cordova plugin add https://github.com/MobileChromeApps/zip.git
as documented (https://github.com/MobileChromeApps/cordova-plugin-zip),
I get the below 404 error message. Has the cordova-plugin-file its trying to reference been moved? How can I tell the plugin to look for it elsewhere if so?
Installing "cordova-plugin-zip" for ios
Fetching plugin "cordova-plugin-file" via plugin registry
npm http GET http://registry.cordova.io/cordova-plugin-file
npm http 404 http://registry.cordova.io/cordova-plugin-file
Failed to install 'cordova-plugin-zip':Error: 404 Not Found: cordova-plugin-file
This plugin now depends on cordova-plugin-file (which is not available on cordova.io for now because it is an unreleased version of org.apache.cordova.file, see https://issues.apache.org/jira/browse/CB-8806).
So this dependency needs to be installed from its GitHub repository, like this:
cordova plugin add https://github.com/apache/cordova-plugin-file.git
And then you can install cordova-plugin-zip:
cordova plugin add https://github.com/MobileChromeApps/zip.git
Note: if you use any other plugin dependending on org.apache.cordova.file (like org.apache.cordova.file-transfer or org.apache.cordova.media), you will have to replace them with their GitHub repositiories too.
I think the correct thing to do is to only download released versions of the plugin by fetching from the (now obsolete) http://plugins.cordova.io registy, or from npm:
Old registry:
cordova plugin add org.chromium.zip
New registry:
cordova plugin add cordova-plugin-zip
Note that you need cordova v5.0.0 to be able to fetch from the new registry (NPM)
Try this:
cordova plugin add https://github.com/MobileChromeApps/cordova-plugin-zip.git
Or this:
cordova plugin add https://github.com/MobileChromeApps/cordova-plugin-zip

Add plugins using cli in cordova 2.5.0

I have tried my best to add a plugins using Command line interface in cordova 2.5.0 but failed to find any solution can u please help me to add plugins
I don't believe you can use the command line to manage cordova 2.5 projects. The node base CLI didn't get added to the project until cordova 2.9.0.
You need to manually add plugins as outlined here: https://cordova.apache.org/docs/en/2.5.0/guide_plugin-development_index.md.html#Plugin%20Development%20Guide

Resources