[ https://issues.apache.org/jira/browse/CB-14166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16618361#comment-16618361 ]
ASF GitHub Bot commented on CB-14166: ------------------------------------- brodybits closed pull request #697: CB-14166 distinguish npm.cmd and npm.exe in win32, to check if escape is necessary (workaround solution in 8.1.x only) URL: https://github.com/apache/cordova-lib/pull/697 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 838da6c74..30664785c 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ "shebang-command": "^1.2.0", "shelljs": "0.3.0", "tar": "^4.4.1", - "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 7fe69209e..1221e64fb 100644 --- a/src/plugman/fetch.js +++ b/src/plugman/fetch.js @@ -19,6 +19,7 @@ var shell = require('shelljs'); var fs = require('fs'); +var which = require('which'); var url = require('url'); var underscore = require('underscore'); var semver = require('semver'); @@ -137,10 +138,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: us...@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-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org