Skip to content

Instantly share code, notes, and snippets.

@aluzed
Forked from arnaudcourtecuisse/npm_bin
Created June 1, 2018 10:21
Show Gist options
  • Save aluzed/fe02b12e90cb8914f4988c2d5f7ddbf7 to your computer and use it in GitHub Desktop.
Save aluzed/fe02b12e90cb8914f4988c2d5f7ddbf7 to your computer and use it in GitHub Desktop.
Add this in your .bashrc to have your local node_modules/.bin in your path
PROMPT_COMMAND=__prompt_command
__prompt_command() {
# Remove previous existing .bin in $PATH
PATH=$(echo $PATH | sed -e "s@[^:]\+node_modules/.bin@@ ; s/\(^:\|:$\)// ; s/::/:/")
# Add current .bin and export
export PATH=$(npm bin):$PATH
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment