Make user-installed global npm packages work with fish
Ever been frustrated that npm install -g
just doesn't quite work? This fixes that. A fish plugin to make yarn global add <pkg>
and npm install -g <pkg>
work with your Fish shell.
Using Fisherman:
fisher install rstacruz/fish-npm-global
With npm: You can add global packages via npm using npm install -g <package>
:
npm install -g benny-hill
With yarn: You can add global packages via Yarn using yarn global add <packagename>
:
yarn global add benny-hill
You'll now be able to run commands installed by yarn or npm!
# before: wtf is going on?
$ benny-hill --help
bash: benny-hill: command not found
# after: hooray!
$ benny-hill --help
To make your bins work outside of fish, put this into your ~/.profile
:
export PATH="$HOME/.node_modules/bin:$PATH"
export npm_config_prefix="~/.node_modules"
fish-npm-global © 2018, Rico Sta. Cruz. Released under the MIT License. Authored and maintained by Rico Sta. Cruz with help from contributors (list).
ricostacruz.com · GitHub @rstacruz · Twitter @rstacruz