Search code examples
cordovacordova-plugins

Cordova 9+ "Failed to fetch plugin via registry"


So I start a new Cordova project.

cordova create myprojectname com.myproject MyProject

I then add Android platform.

cordova platform add android

I then add iOS platform

cordova platform add ios

I then attempt to add a plugin.

cordova plugin add cordova-plugin-wkwebview-engine

I get this error:

Failed to fetch plugin cordova-plugin-wkwebview-engine via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 4294963238 Error output:
npm WARN [email protected] No repository field.

npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path C:\PATH-TO-MY-PROJECT\myprojectname\node_modules\cordova-plugin-wkwebview-engine
npm ERR! dest C:\PATH-TO-MY-PROJECT\myprojectname\node_modules\.cordova-plugin-wkwebview-engine.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\PATH-TO-MY-PROJECT\myprojectname\node_modules\cordova-plugin-wkwebview-engine' -> 'C:\PATH-TO-MY-PROJECT\myprojectname\node_modules\.cordova-plugin-wkwebview-engine.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\PATH-TO-MY-APP-DATA\AppData\Roaming\npm-cache\_logs\2020-06-09T01_12_38_805Z-debug.log

In fact, I get this error for ANY and ALL plugins I attempt to install.

I'm using Node.js Command Prompt with these versions:

npm: '6.14.5'
node: '12.13.1 (x64)'
cordova: '9.0.0 ([email protected])'
cordova-android: '^8.1.0'
cordova-ios: '^5.1.1'

How can I start installing plugins?

Update 1 I should state that if I roll my cordova back to version 7.0.0 or below, I am able to install plugins. However, I really need to keep things up to date in order to target the new iOS 5+ platform.


Solution

  • OK, here's an answer of sorts.

    When I work in a project sitting outside of a Dropbox directory, everything works.

    Funny thing is - I've been creating/building cordova apps from within Dropbox directories for years without any issues as I'm sure many people do. So this is a bit of a head scratcher for me.

    I'm not sure why yet but the answer in this case is bizarely: Work outside Dropbox.