Guide to Node

We use node a lot. Federated wiki is created and installed with node, and many services and packages we wish to use (such as n8n), are also installed using node.

We have often encountred issues installing the latest version of node - espeacially when coming across and ol machine. Here we show how to do it properly using nvm which specialises in fixing such issues.

> Step-by-Step: Get nvm to Offer and Use Latest Node

# 1. **Ensure You're Using `nvm`'s Version** Run:

nvm ls

Check if you see something like:

v19.8.1 -> v19.8.1 system

If there's **no v20 or later**, it means you haven’t installed it yet via `nvm`.

# 2. **Install the Latest LTS Version via `nvm`** Run:

nvm install --lts

This will download and install the latest **LTS** version (currently v20.x), which is fully compatible with the latest `npm`.

# 3. **Switch to That Version** After install, run:

nvm use --lts nvm alias default lts/*

Then confirm:

node -v # should show v20.x.x npm -v # should show npm 10 or 11 which node # should point to ~/.nvm/versions/...

# If `nvm install --lts` Still Doesn't Offer v20 This can happen if `nvm`'s version list is stale. Update it:

nvm ls-remote --lts

Then install the newest LTS you see listed:

nvm install v20.14.0 # or whatever the latest is nvm use v20.14.0 nvm alias default v20.14.0

# 4. **(Optional) Remove Old Node** If you were using Node 19 from a global install (like Homebrew), and now want to rely purely on `nvm`:

# Uninstall old node If previously installed via Homebrew:

brew uninstall node

Or uninstall manually:

sudo rm -f /usr/local/bin/node /usr/local/bin/npm