diff options
author | joan xie <w4ergf@qq.com> | 2019-09-20 08:44:42 +0300 |
---|---|---|
committer | claudiahdz <cghr1990@gmail.com> | 2019-11-14 20:11:49 +0300 |
commit | 3471d5200217bfa612b1a262e36c9c043a52eb09 (patch) | |
tree | bdd8cd2bcdd5ddfd0129f09de60f256299b0a858 /bin | |
parent | dbbf977acd1e74bcdec859c562ea4a2bc0536442 (diff) |
windows: Add preliminary WSL support for npm and npx
This commit would make it possible to run `npm` installed on Windows within Windows Subsystem for Linux.
It is required, however, that the end of line characters of `npm` and `npx` be `\n` for the fix to take effect.
PR-URL: https://github.com/npm/cli/pull/253
Credit: @infinnie
Close: #253
Reviewed-by: @claudiahdz
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/npm | 4 | ||||
-rw-r--r-- | bin/npx | 4 |
2 files changed, 8 insertions, 0 deletions
@@ -8,6 +8,10 @@ case `uname` in esac NODE_EXE="$basedir/node.exe" +if [ -x "$NODE_EXE" ] && [ -f "/bin/wslpath" ]; then # run the corresponding command prompt when Node for Windows is executed within WSL + cmd.exe /c `wslpath -w "$basedir/npm.cmd"` "$@" + exit $? +fi if ! [ -x "$NODE_EXE" ]; then NODE_EXE="$basedir/node" fi @@ -8,6 +8,10 @@ case `uname` in esac NODE_EXE="$basedir/node.exe" +if [ -x "$NODE_EXE" ] && [ -f "/bin/wslpath" ]; then # run the corresponding command prompt when Node for Windows is executed within WSL + cmd.exe /c `wslpath -w "$basedir/npx.cmd"` "$@" + exit $? +fi if ! [ -x "$NODE_EXE" ]; then NODE_EXE=node fi |