Fast Node Management With fnm
Use the installation script from
$ curl -fsSL https://github.com/Schniz/fnm/raw/master/.ci/install.sh | bash
The command downloads
fnm, installs it and adds a loader to bash.
The installation script above adds the following lines to
export PATH="~/.fnm:PATH"eval "`fnm env --multi`"
This won't work in fish. You can delete those lines.
But bash is only the container for the interactive fish shell.
Here's (part of my)
Now set the fish user path:
$ set -U fish_user_paths ~/.fnm $fish_user_paths
Plus, add this line to the
fnm env --multi | source
fnm is available in fish shell.
Install a node version with
fnm install and alias it.
My solution comes from a GitHub issue: minimize globally installed packages, put the necessary packages into a dedicated folder.
Create a folder to hold the globally installed packages, for example
$ npm config set prefix `~/.npmbin`
Now use the normal command to install a package globally with
npm install -g. The packages now land in
Add this to $PATH:
$ set -U fish_user_paths ~/.npmbin/bin $fish_user_paths