Using nvm with in Fish shell 🎏

Short post about how to install nvm in fish shell, it is not complicated but it is not smooth neither, so here you go.

Using nvm with in Fish shell 🎏
Photo by NEOM / Unsplash

NVM is a must to have if you're a front-end web developer, and fish shell is an amazing shell environment, but nvm and Fish does not work together because nvm uses bash scripts, so you should use a nvm with a fish wrapper via fisher fisher is a plugin manager for fish.

And you doesn't need to uninstall your system node or npm.

Install nvm with fisher

First install fisher by following the instructions in fisher's Github page, after that you will be able to install nvm with the command:

fisher install jorgebucaran/nvm.fish

After that you will be able to list your node versions with:

nvm ls

it will show something like

   system  
   v16.20.0 lts/gallium 
 ▶ v21.6.2 latest 

in my case I have the system node which I installed via pacman in my Arch linux, and v16 and v21, last one I installed with the command

nvm install latest

but you must to use it with

nvm use latest

with this command you will use that node version with the current terminal, but if you would like to persist as default for next terminal sessions, you should set the corresponding variable

set --universal nvm_default_version latest

with last command you will use that version even in new terminal sessions.