Last active
November 20, 2020 11:48
-
-
Save anatooly/758fa0c07df9e767cc4f632447e9c1f2 to your computer and use it in GitHub Desktop.
ZSH project node_modules bin file run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adds node_modules/.bin to the PATH | |
# vi -c ":set nobomb" -c ":wq" ~/.zshrc macOs utf-8 char problem | |
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