Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorHutson Betts <hbetts@factset.com>2016-02-13 01:20:02 +0300
committerRebecca Turner <me@re-becca.org>2016-02-24 03:51:51 +0300
commitd60351ccae87d71a5f5eac73e3085c6290b52a69 (patch)
tree391d7051658262b1951a4340659dcd39a85aeb11 /bin
parentb63de3c97c4c27078944249a4d5bbe1c502c23bc (diff)
npm-bin: Prefer locally installed npm in Git Bash.
Existing behavior invoking npm within a Git Bash session is to prefer the globally installed instance of `npm`; the instance of npm installed alongside Node when using the Node installer. The cmd script, and the shell script, have been modified in the past to pull a `prefix` setting from the global `npmrc` file, and invoke the `npm` instance located at the `prefix` location. Because the value of `prefix` is the user's AppData directory where npm installs new copies of itself, the user gets the latest installed npm. However, the setup was not extended to support Git Bash. Therefore Git Bash users still get the version of npm installed beside Node. Add support for using the same prefix for invoking the user installed npm in Git Bash sessions. PR-URL: https://github.com/npm/npm/pull/11526 Credit: @destroyerofbuilds Reviewed-By: @iarna Fixes: #11524
Diffstat (limited to 'bin')
-rwxr-xr-xbin/npm7
1 files changed, 7 insertions, 0 deletions
diff --git a/bin/npm b/bin/npm
index 45e8e4103..5acd6fb61 100755
--- a/bin/npm
+++ b/bin/npm
@@ -15,6 +15,13 @@ fi
NPM_CLI_JS="$basedir/node_modules/npm/bin/npm-cli.js"
case `uname` in
+ *MINGW*)
+ NPM_PREFIX=`"$NODE_EXE" "$NPM_CLI_JS" prefix -g`
+ NPM_PREFIX_NPM_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npm-cli.js"
+ if [ -f "$NPM_PREFIX_NPM_CLI_JS" ]; then
+ NPM_CLI_JS="$NPM_PREFIX_NPM_CLI_JS"
+ fi
+ ;;
*CYGWIN*)
NPM_PREFIX=`"$NODE_EXE" "$NPM_CLI_JS" prefix -g`
NPM_PREFIX_NPM_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npm-cli.js"