Skip to content

Instantly share code, notes, and snippets.

@seanstrom
Created April 13, 2014 17:06
Show Gist options
  • Save seanstrom/10592867 to your computer and use it in GitHub Desktop.
Save seanstrom/10592867 to your computer and use it in GitHub Desktop.
NPM local node modules path hook
npm_chpwd_hook() {
if [ -n "${PRENPMPATH+x}" ]; then
PATH=$PRENPMPATH
unset PRENPMPATH
fi
if [ -f package.json ]; then
PRENPMPATH=$PATH
PATH=$(npm bin):$PATH
fi
}
add-zsh-hook preexec npm_chpwd_hook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment