Configuring your Workstation for Node Development

Setting up with workstation to develop with Node.js or any JavaScript and TypeScript based projects.

Published 2025-03-08

Introduction

We can develop our Node.js (React, Next.js, Svelte, etc) projects with locally installed Node binaries or within a containerized environment, but having a local node development environment set up without the associated complexity of a containerization is always useful to try things out whatever our main development environment is. We can also use it as a learning environment, and even for full projects if suitable.

Many of the tutorials on this site assume you have this local node development environment set up for convenience.

Install Node.js and npm

These instructions are universal for Linux, MacOS and Windows, but for windows it is assumed you are using WSL2 with Ubuntu installed, as per the guide here.

If you are using Linux (including Windows with WSL2) Node.js may be available as a package in your distribution, and in most cases installing packages that way is recommended for ease, reliability and security. However as a Node.js developer I would advise against doing that for Node and instead to download and use a Node.js package manager instead. There may be many occasions when you need to install or revert to a specific version of Node.js for projects and testing code, and the package manager is by far the easiest way to do this.

Probably the most well known node manager is 'nvm' (Node Version Manager) which has been around for a long time and is still reliably being used by many developers, however we are going to use a newer tool, fnm which is known for its speed. It has been been around for a number years now and continues to grow in popularity. I personally switched to it about a year ago and have found no reason to look back. Guides on this site will assume you are using fnm however if you prefer to use 'nvm' or another tool, that's fine, just follow the appropriate instructions.

Install fvm

You should not run any of these commands as root, the packages get installed in your personal user directory, just log into your regular user account which you'll be using for development (in the case of Windows/WSL2, just open a Ubuntu terminal).

$ curl -fsSL https://fnm.vercel.app/install | bash

fnm will now be installed and ready to use from your next login, however if you prefer not to log in just yet, simply run the command given to apply the needed changes to your current shell session, or just run this one:

$ source ~/.bashrc

Now, check that fnm is installed correctly and available:

$ fnm --version

fnm has some very nice configurable features, such as the ability to switch to a specific version of Node.js for a particular project simply by changing into the project directory without running any additional commands, however for the time being we will just install the latest LTS version of Node.js and make it the default:

$ fnm install --lts
$ fnm list

You should see that the latest LTS version of Node.js is now the default, if not, you can make it the default by running:

$ fnm default --lts

If you now source your ~/.bashrc file again (as happens on a new login), you should see the new default version of Node.js:

$ source ~/.bashrc
$ node --version

Optional: If you are interested in using the automatic version switching feature and are comfortable with editing your ~/.bashrc file, change the line:

eval "`fnm env`"

to:

eval "`fnm env --use-on-cd`"

Now, after you next log in (or you source your ~/.bashrc file again) if you change into a directory containing a project that has a .node-version file, fnm will automatically switch to the version specified in the .node-version file. If the needed version is not available you can install it with fnm install [version number]

© 2025 Goldnode. All rights reserved.