Humberto Júnior

View on GitHub
15 April 2025

How to Install Node.js Using NVM on Linux (Including Fish Shell Users)

by Humberto Jr (bt0)

Managing multiple Node.js versions on your machine shouldn't be a headache. This guide will show you how to install Node.js using NVM (Node Version Manager) — and yes, it works even if you're using Fish Shell!

What is NVM?

NVM (Node Version Manager) allows you to easily install and switch between multiple Node.js versions without messing up your system.

Step 1 - Installing NVM (Bash or Zsh Users)

Run:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash

Then load NVM:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

Now install Node.js:

nvm install 20
nvm use 20

Check Node version:

node -v

Problem: Fish Shell Error

If you see this error:

~/.nvm/nvm.sh (line 457): Unexpected ')' found, expecting '}'
*[!/]*/)

That happens because Fish Shell doesn't support some Bash syntax.

Install it like this:

curl -sL https://git.io/nvm.fish | source

Make it permanent:

curl -sL https://git.io/nvm.fish | source >> ~/.config/fish/config.fish

Install Node.js:

nvm install latest
nvm use latest
node -v

Useful Commands

List all available Node.js versions:

nvm ls-remote

Install a specific Node.js version:

nvm install 18

Use a specific Node.js version:

nvm use 18

List installed versions:

nvm ls

Set a default version:

nvm use 20 --default

Final Result

Now your Node.js environment is ready, organized, and flexible — no matter which terminal you're using.

Happy coding! 🚀

tags: nodejs nvm linux fish-shell tutorial