-
-
Save akaia-shadowfox/c030ec3dae471092a94eed2327634d68 to your computer and use it in GitHub Desktop.
Access to "C:\Program Files\nodejs\npm" from WSL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix | |
basedir=`dirname "$0"` | |
case `uname` in | |
*CYGWIN*) basedir=`cygpath -w "$basedir"`;; | |
esac | |
NODE_EXE="$basedir/node.exe" | |
if ! [ -x "$NODE_EXE" ]; then | |
NODE_EXE="$basedir/node" | |
fi | |
if ! [ -x "$NODE_EXE" ]; then | |
NODE_EXE=node | |
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" | |
if [ -f "$NPM_PREFIX_NPM_CLI_JS" ]; then | |
NPM_CLI_JS="$NPM_PREFIX_NPM_CLI_JS" | |
fi | |
;; | |
*Linux*) # for WSL | |
NODE_EXE="/mnt/c/Program Files/nodejs/node.exe" | |
NPM_CLI_JS="C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" | |
;; | |
esac | |
"$NODE_EXE" "$NPM_CLI_JS" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment