asdf-nodejs/bin/exec-path
Andrew Thauer 7b6df2d0c6 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.
2018-04-25 22:32:34 -04:00

16 lines
268 B
Bash
Executable File

#!/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"