cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-14166) Cordova on windows fails when adding plugin
Date Tue, 18 Sep 2018 01:39:00 GMT

    [ https://issues.apache.org/jira/browse/CB-14166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16618365#comment-16618365
] 

ASF GitHub Bot commented on CB-14166:
-------------------------------------

brodybits closed pull request #688: CB-14166 distinguish npm.cmd and npm.exe in win32, to
check if escape is necessary (workaround solution)
URL: https://github.com/apache/cordova-lib/pull/688
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/package.json b/package.json
index 277b0c7a0..47290081e 100644
--- a/package.json
+++ b/package.json
@@ -34,7 +34,8 @@
     "read-chunk": "^3.0.0",
     "semver": "^5.3.0",
     "shebang-command": "^1.2.0",
-    "underscore": "^1.9.0"
+    "underscore": "^1.9.0",
+    "which": "^1.3.1"
   },
   "devDependencies": {
     "codecov": "^3.0.1",
diff --git a/src/plugman/fetch.js b/src/plugman/fetch.js
index d52bae7aa..dd1e28d8c 100644
--- a/src/plugman/fetch.js
+++ b/src/plugman/fetch.js
@@ -18,6 +18,7 @@
 */
 
 var fs = require('fs-extra');
+var which = require('which');
 var url = require('url');
 var underscore = require('underscore');
 var semver = require('semver');
@@ -136,10 +137,13 @@ function fetchPlugin (plugin_src, plugins_dir, options) {
                 }
 
                 if (process.platform === 'win32' && parsedSpec.version) {
-                    var windowsShellSpecialCharacters = ['&', '\\', '<', '>', '^',
'|'];
-                    specContainsSpecialCharacters = windowsShellSpecialCharacters.some(function
(character) {
-                        return parsedSpec.version.indexOf(character);
-                    });
+                    var npmExtension = path.extname(which.sync('npm'));
+                    if (npmExtension && npmExtension.toUpperCase() !== '.EXE') {
+                        var windowsShellSpecialCharacters = ['&', '\\', '<', '>',
'^', '|'];
+                        specContainsSpecialCharacters = windowsShellSpecialCharacters.some(function
(character) {
+                            return parsedSpec.version.indexOf(character) >= 0;
+                        });
+                    }
                 }
 
                 var fetchPluginSrc = specContainsSpecialCharacters ?


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Cordova on windows fails when adding plugin
> -------------------------------------------
>
>                 Key: CB-14166
>                 URL: https://issues.apache.org/jira/browse/CB-14166
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-windows
>            Reporter: takuya
>            Assignee: Jesse MacFadyen
>            Priority: Blocker
>         Attachments: screenshot-1.png, スクリーンショット 2018-09-06 11.36.42.png
>
>
> cordova on windows fails to add the plugin.
> This error happens even when cordova-plugin-whitelist.
> Therefore `cordova platform add windows` also fails.
> For example,
> ```
> > cordova create sample
> > cd sample
> > cordova platform add windows
> ```
> brings following error.
> ```
> ...
> Check your connection and plugin name/version/URL.
> Error: C:\Program Files (x86)\Nodist\bin\npm.exe: Command failed with exit code 1 Error
output:
> npm ERR! code EINVALIDTAGNAME
> npm ERR! Invalid tag name ""1"": Tags may not have any characters that encodeURIComponent
encodes.
> ```
> This error happens for windows environment only.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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


Mime
View raw message