blog title

Best way to manage Node.js

2022-02-25

Installation and updating of Node.js can be sometimes little complicated or annoying, there can be issues with version in your distribution’s repository or after update of npm will start showing weird errors.

The solution is to use Node Version Manager.

NVM installation

We will download and run nvm install shell script (check this link if code bellow is outdated):

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

or with wget

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

Node installation

to download, compile, and install the latest release of node, do this:

nvm install node # "node" is an alias for the latest version

to install a specific version of node:

nvm install 14.7.0 # or 16.3.0, 12.22.1, etc

Node update

to update node to latest version run:

nvm install node --reinstall-packages-from=node

to update Stable (LTS) version: (if currently in use):

nvm install "lts/*" --reinstall-packages-from="$(nvm current)"

Matúš Barta • 2024 • All Rights Reserved •

twitter instagram youtube github