diff options
author | Hutson Betts <hbetts@factset.com> | 2016-02-13 01:20:02 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2016-02-24 03:51:51 +0300 |
commit | d60351ccae87d71a5f5eac73e3085c6290b52a69 (patch) | |
tree | 391d7051658262b1951a4340659dcd39a85aeb11 /bin | |
parent | b63de3c97c4c27078944249a4d5bbe1c502c23bc (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-x | bin/npm | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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" |