You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Shazron Abdullah (JIRA)" <ji...@apache.org> on 2015/08/26 17:21:46 UTC

[jira] [Created] (CB-9559) Adding a plugin with caret in version results in an error

Shazron Abdullah created CB-9559:
------------------------------------

             Summary: Adding a plugin with caret in version results in an error
                 Key: CB-9559
                 URL: https://issues.apache.org/jira/browse/CB-9559
             Project: Apache Cordova
          Issue Type: Bug
          Components: CordovaLib
    Affects Versions: 5.2.0
         Environment: OS X 10.10.5 
cordova-cli 5.2.0
            Reporter: Shazron Abdullah
            Priority: Critical


*Repro:*
{code}
cordova plugin add cordova-plugin-battery-status@^1.0.0
Fetching plugin "cordova-plugin-battery-status@^1.0.0" via npm
Failed to fetch plugin cordova-plugin-battery-status@^1.0.0 via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: No compatible version found: cordova-plugin-battery-status@'">=1.0.0 <2.0.0"'
Valid install targets:
["0.2.1","0.2.3","0.2.4","0.2.5","0.2.6","0.2.7","0.2.9","0.2.10","0.2.11","0.2.12","1.0.0","1.1.0"]
{code}

*Expected:*
The plugin can be installed

*Actual:*
The plugin cannot be installed.

Note in the error log, the version is expanded from:
{code}
 @^1.0.0
{code}
to:
{code}
@">=1.0.0 <2.0.0"
{code}


But, it appears the double quotes around the expanded version in the error log are *wrapped with single quotes* now, resulting in the error.

The version is expanded using this *processPluginVersion* function:
https://github.com/apache/cordova-lib/blob/3e34b557c8bb6876022f0a4186b81d4ff8e5da75/cordova-lib/src/plugman/registry/registry.js#L282

>From this commit:
https://github.com/apache/cordova-lib/commit/024b970b26d3d8b7f9a6b2f0eab2325d7716deef

The fix appears to be not calling the function *processPluginVersion* and passing it to *npm cache add* as is:
https://github.com/apache/cordova-lib/blob/3e34b557c8bb6876022f0a4186b81d4ff8e5da75/cordova-lib/src/plugman/registry/registry.js#L270

The purpose of this function is because we are using an older version of npm that may not understand carets. Is this still truly the case? If not, we could get rid of this function -- while still keeping CB-9147 fixed/resolved



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org