fnm Setup 🔗︎
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`"
I use fish shell as my interactive shell. That means that Linux starts bash, and bash then delegates to the fish shell.
Here's (part of my)
The lines that
fnm added to
.bashrc won't work. You can delete them.
Instead, 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.
How to install globally available packages across all node versions? 🔗︎
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