DEV Community

Cover image for Install Fast Node Manager (fnm)
Ruben Alvarado
Ruben Alvarado

Posted on

Install Fast Node Manager (fnm)

Originally Posted on Web Warrior Toolbox

This article describes how to set node in dev-pc using fish or bash shell.

1. Download fnm

In your dev pc you need to be able to change node version easily for each of your projects. you can do that with fnm. whether or not you have node installed in dev-pc you can install it right from the start. (you need to have unzip installed)

curl -fsSL https://fnm.vercel.app/install | bash
Enter fullscreen mode Exit fullscreen mode

fnm repo

2. Set Environment Variables

Now you have to set environment variables of your shell (bash, zsh, fish, etc).

For Fish

Edit ~/.config/fish/config.fish and add this to the end

set PATH $HOME/.fnm:$PATH
fnm env | source
Enter fullscreen mode Exit fullscreen mode

restart fish

exec fish
Enter fullscreen mode Exit fullscreen mode

For Bash

update environment variables

source /<HOME-FOLDER>/.bashrc
Enter fullscreen mode Exit fullscreen mode

3. Install Node

now you can install and use the node version you want. e.g.

fnm install 20
fnm use 20
Enter fullscreen mode Exit fullscreen mode

install pnpm globally so its independent of the version of node you use

npm install -g pnpm
Enter fullscreen mode Exit fullscreen mode

now in you project you can execute

pnpm install
pnpm run dev
Enter fullscreen mode Exit fullscreen mode

That's the end. Keep an eye always ready to lean, dev-san.πŸ₯·

Top comments (0)