Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions bin/npm
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix

basedir=`dirname "$0"`
isexe=0

case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac

NODE_EXE="$basedir/node.exe"
if [ -x "$NODE_EXE" ]; then
isexe=1
fi
if ! [ -x "$NODE_EXE" ]; then
NODE_EXE="$basedir/node"
fi
Expand All @@ -34,4 +38,9 @@ case `uname` in
;;
esac

if [ isexe==1 ] && [ -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"` "$@"
return
fi

"$NODE_EXE" "$NPM_CLI_JS" "$@"
9 changes: 9 additions & 0 deletions bin/npx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix

basedir=`dirname "$0"`
isexe=0

case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac

NODE_EXE="$basedir/node.exe"
if [ -x "$NODE_EXE" ]; then
isexe=1
fi
if ! [ -x "$NODE_EXE" ]; then
NODE_EXE=node
fi
Expand All @@ -32,4 +36,9 @@ case `uname` in
;;
esac

if [ isexe==1 ] && [ -f "/bin/wslpath" ]; then # run the corresponding cmd instead
cmd.exe /c `wslpath -w "$basedir/npx.cmd"` "$@"
return
fi

"$NODE_EXE" "$NPX_CLI_JS" "$@"