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/bassInstall nvm (check what’s the latest version).
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bashAdd fish function to ~/.config/fish/functions/nvm.fish to load nvm:
function nvm bass source ~/.nvm/nvm.sh --no-use ';' nvm $argvendNVM 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.0List all installed node versions:
nvm lsSelect a specific version when you need it:
nvm use 11.6.0You can specify NodeJS version for your project and activate it using a single command:
- Create a
.nvmrcfile inside your project with node version, like11.6.0. - Use
nvm useto activate it.
Read more here.