Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova "failed to fetch plugin" error

Tags:

cordova

I've run into this "Failed to fetch plugin error" quite frequently lately. It seems especially easy to prop up if I download my own branch:

t2wu@THW-air:~/Documents/Work/John/DEMO_APP/BCAppII(dev) $ cordova plugin add https://github.com/t2wu/cordova-plugin-geofence.git#t2wu

Error: Failed to fetch plugin https://github.com/t2wu/cordova-plugin-geofence.git#t2wu via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. Failed to get absolute path to installed module

If I download a plugin like cordova plugin add cordova-plugin-geofence, but when I have to use a specific repo, especially a branch on that repo, it fails frequently.

I am using Cordova 7.1.0. (Cordova 8 have other issues I'm not willing to touch right now.)

like image 730
huggie Avatar asked Jan 17 '18 04:01

huggie


2 Answers

For anyone who faced this problem, it turns out cordova is trying to fetch via registry every time when repo name do not match with plugin id. I was able to install plugins from private bitbucket just changing the repo name

like image 98
Vladimir Pustolovskiy Avatar answered Oct 10 '22 08:10

Vladimir Pustolovskiy


Try the following:

cordova plugin add https://github.com/t2wu/cordova-plugin-geofence.git#t2wu --nofetch

If it doesn't work. Do the following step:

  1. Remove all platform (cordova platform rm android) and (cordova platform rm ios)

  2. Remove all plugins cordova plugin rm plugin-name.

  3. If step2 failed, then delete all plugins using a file manager from directory <projectroot>/plugins

  4. Add all plugins

  5. Add https://github.com/t2wu/cordova-plugin-geofence.git#t2wu

  6. Add all platform.

like image 30
I. Ahmed Avatar answered Oct 10 '22 08:10

I. Ahmed