NVM does not support fish shell.
Fortunately, there is an easy way to fix that. We can install the bass plugin to use utilities written for Bash.
Install bass using fisher (you can also use oh-my-fish).
fisher add edc/bass
Install nvm (check what’s the latest version).
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
Add fish function to ~/.config/fish/functions/nvm.fish
to load nvm:
function nvm bass source ~/.nvm/nvm.sh --no-use ';' nvm $argvend
NVM is ready to use.
How does it work?
You can install a specific version of node (and have multiple versions in your system):
nvm install 11.6.0
List all installed node versions:
nvm ls
Select a specific version when you need it:
nvm use 11.6.0
You can specify NodeJS version for your project and activate it using a single command:
- Create a
.nvmrc
file inside your project with node version, like11.6.0
. - Use
nvm use
to activate it.
Read more here.