1 min read
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.
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 | bashor with wget
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bashto download, compile, and install the latest release of node, do this:
nvm install node # "node" is an alias for the latest versionto install a specific version of node:
nvm install 14.7.0 # or 16.3.0, 12.22.1, etcto update node to latest version run:
nvm install node --reinstall-packages-from=nodeto update Stable (LTS) version: (if currently in use):
nvm install "lts/*" --reinstall-packages-from="$(nvm current)"