404 error when trying to install Cordova plugin in Visual Studio

353 views Asked by At

I'm building a Cordova web app using Visual Studio 2015. I'm trying to add the Amazon Mobile Ads Cordova plugin to the project manually. The following lists the steps I am following, and (at the end) the error I keep getting:

 1. I download Amazon Mobile Ads SDK from Amazon Developer site.
 2. I unzip the plugin contained within the SDK zip file into its own directory:
    C:\AmazonSDK
    (In other words, C:\AmazonSDK is where plugin.xml is located.)
 3. I create a new Cordova app project in Visual Studio called MyCordovaApp.
 4. I double-click on config.xml in Visual Studio to bring up the designer.
 5. I select "PlugIns", and then I select Custom.
 6. I choose "Local", and then browse to the plugin directory C:\AmazonSDK.
 7. I click on "Add".

The process fails and I get this error in the output console:

 Error: Registry returned 404 for GET on https://registry.npmjs.org/MyCordovaApp

I've also tried manually adding the plugin from the command line by navigating to the Visual Studio project folder and executing:

cordova plugin add C:\AmazonSDK

I get the same error as stated above.

Any ideas on how to resolve this? I surmise that Cordova is looking at the project name in my config.xml file (i.e. "MyCordovaApp"), and then looking for a registry entry at registry.npmjs.org, but I'm not clear why it's doing this or how to add this plugin.

UPDATE: Here is the complete Visual Studio console output, along with the error (and as you can see, the actual directory location of my plugin is a little different from what I listed in the original question):

Visual Studio console output

2

There are 2 answers

0
AudioBubble On BEST ANSWER

Of course, the solution to the error described above had to be something silly. The error occurred because I used spaces in my original path to my plugin:

ORIGINAL PATH: C:\Amazon Mobile Ad Cordova SDK\Amazon-Cordova-SDKs\AmazonMobileAds

NEW PATH: C:\Amazon-Mobile-Ad-Cordova-SDK\Amazon-Cordova-SDKs\AmazonMobileAds

With the new path (and no spaces), the install completed successfully!

4
Elvis Xia - MSFT On

I followed your steps and reproduced the issue, after checking of the plugin.xml file. I found there is an empty line ahead of <?xml version="1.0" encoding="UTF-8"?>, which prevents VS from parsing the file.

Deleting this empty line will resolve the issue.