How to Install Node.js and NPMon Linux – (1 command)

Install Nodejs NPM VPS Linux Ubuntu Debian

How to Install Node.js and NPM on VPS and Linux Ubuntu/Debian. 1 single command for LTS Node version with NPM. Here I’m using NodeSource because if we use sudo apt install nodejs npm this command then the older Node version 12.xx will installed so, avoid this command and follw NodeSource for any version either 18.xx, 20.xx or any LTS version.

Note:

  • Don’t use Ubuntu repository (it has old nodejs 12.xx)
  • Use NodeSource for latest node version or any version
    • Working for Ununtu 20.04 or latest, Debian 10, 11, 12, Ubuntu Desktop etc

Visit: https://deb.nodesource.com/

https://deb.nodesource.com/

Or run below command for Nodejs latest version withh NPM.

Install Node.JS and NPM from NodeSource

sudo apt-get update && sudo apt-get install -y ca-certificates curl gnupg
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update && sudo apt-get install nodejs -y
run cmd on terminal

Hit entry, type password if any.

Nodejs Npm version results after installing

after installing node npm results
nodejs npm versions

Conclusion

The flexibility, scalability, and large ecosystem of packages of Node.js make it an ideal solution for a wide range of applications. You now know how to install Node.js using three different methods: the Ubuntu repository, the NodeSource repository, and Node Version Manager. You have successfully installed Node.js on Ubuntu 22.04, Debian 10, 11, 12 if you followed all of the steps.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *