Skip to content

Instantly share code, notes, and snippets.

@jasonkarns
Created January 4, 2019 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonkarns/fe7981ae3627a404ad13ede3a7173328 to your computer and use it in GitHub Desktop.
Save jasonkarns/fe7981ae3627a404ad13ede3a7173328 to your computer and use it in GitHub Desktop.
nodenv exec hook to make npx happy
[ "$NODENV_COMMAND" = npx ] || return 0
remove_from_path() {
local path_to_remove="$1"
local path_before
local result=":${PATH//\~/$HOME}:"
while [ "$path_before" != "$result" ]; do
path_before="$result"
result="${result//:$path_to_remove:/:}"
done
result="${result%:}"
echo "${result#:}"
}
PATH="$(remove_from_path "${NODENV_ROOT}/shims")"
export PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment