fish-npm-global

Make user-installed global npm packages work with fish

MIT License

Stars
5
Committers
2

fish-npm-global

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.

Install

Using Fisherman:

fisher install rstacruz/fish-npm-global

Usage

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

Does it only work with fish?

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"

How it works

See conf.d/npm-global.fish.

Thanks

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