Fix Issue #56: Can't install latest version of npm globally

This works in tandom with a change in asdf core that will look for the
exec-path command and use it appropriately when found to conditionally
route the npm & npx commands to the correct executable path.
This commit is contained in:
Andrew Thauer 2018-04-25 22:32:34 -04:00
parent 7edd9d6b9a
commit 7b6df2d0c6

15
bin/exec-path Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env bash
install_path=$1
cmd=$2
executable_path=$3
if [[ "$cmd" == "npm" ]] || [[ "$cmd" == "npx" ]]; then
npm_bin_cmd=".npm/bin/$cmd"
if [[ -f "$install_path/$npm_bin_cmd" ]]; then
executable_path="$npm_bin_cmd"
fi
fi
echo "$executable_path"