Can I install a previous version of a plugin using the cordova plugin add command?
Asked Answered
A

3

44

I am trying to rebuild a cordova project from scratch and creating documentation along the way. I would like to be able to install consistent versions of plugins to avoid having to retest new code for the time being. Is there a way to specify a previous version of a plugin similar to the way you can specify a previous version of cordova? For example, I am familiar with the following syntax to install a specific version of cordova:

npm install -g [email protected]

And I'm able to install a plugin with the following syntax:

cordova plugin add org.apache.cordova.device

I would like to be able to so something like the following:

cordova plugin add [email protected]

Any insight including "not possible" would be helpful. Thanks!

Apostolate answered 27/1, 2014 at 20:53 Comment(0)
A
69

from official cordova website

http://cordova.apache.org/news/2013/10/21/cordova-registry.html

From anywhere within an app’s directory, plugins can be added to a project with

cordova plugin add [PLUGIN_ID]

where PLUGIN_ID is the id (typically reverse-domain style) shown on the plugin registry website. You can also download a specific version of a plugin:

cordova plugin add [PLUGIN_ID]@[VERSION]
Amaze answered 29/1, 2014 at 1:35 Comment(3)
which is basically what you have, so not sure if you already tried that commandAmaze
Yes, I actually tried that command using several different version number formats (for example, when installing Cordova 3.1 using '@3.1' works but '@3.1.0' doesn't) so I tried a few different formats with the device plugin ('@0.2.1', '@2.1', etc.) so maybe there is just an issue with the registry. But thank you for the link to the documentation. I'll mark it as answered.Apostolate
Found that the command works fine, it was just that 0.2.2 is the oldest version of the device plugin in the registry.Apostolate
D
14

I had a similar problem with a plugin. This is how it worked for me:

Usually I would have added the plugin like this

cordova plugin add org.apache.cordova.contacts

Instead I fetched the plugin from github like this (note the version tag at the end)

cordova plugin add https://github.com/apache/cordova-plugin-contacts#1.1.0
Donoghue answered 4/2, 2016 at 22:7 Comment(1)
For my specific issue it was not the plugin's fault, the solution was installing a different cordova iOS version. I went from 4.0.1(bad) to 4.1.0 (good) then finally to 3.9.2 because of iOS6,7 support.Anthropophagite
G
1

First is First we need to remove currently installed version plugin

cordova plugin remove <plugin-name>@<version>

then install required plugin

cordova plugin add <plugin-name>@<version>
Grotesquery answered 15/6, 2022 at 16:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.