Install Nodejs from Nodesource

Wed May 12 2021

Nodejs is a cross-platform runtime, you can install it on almost every popular OS.

However, node's version managed by each OS' package manager can be different and obsolete.

So just install it from nodesource, the official script will take care of the package source and version.

Debian and Ubuntu based distributions

LTS

bash
|
# Using Ubuntu curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - sudo apt-get install -y nodejs # Using Debian, as root curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - apt-get install -y nodejs

Current

bash
|
# Using Ubuntu curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash - sudo apt-get install -y nodejs # Using Debian, as root curl -fsSL https://deb.nodesource.com/setup_current.x | bash - apt-get install -y nodejs

Enterprise Linux based distributions

LTS

bash
|
# As root curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash - # No root privileges curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -

Current

bash
|
# As root curl -fsSL https://rpm.nodesource.com/setup_current.x | bash - # No root privileges curl -fsSL https://rpm.nodesource.com/setup_current.x | sudo bash -