Welcome! This guide will help beginners install the latest version of Node.js on Ubuntu using NVM (Node Version Manager) and NPM (Node Package Manager). Follow the steps below to get started. 🚀
- A machine running Ubuntu.
- Basic knowledge of using the terminal.
Before we begin, update your system packages to ensure compatibility. 🛠️
sudo apt update && sudo apt upgrade -yCurl is needed to download the NVM installation script. 📥
sudo apt install curl -yNVM makes it easy to install and manage Node.js versions. Run the following command to install NVM:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bashClose and reopen your terminal, or run:
source ~/.bashrcThen check if NVM is installed:
nvm --versionIf you see a version number, NVM is successfully installed! 🎉
Now that NVM is installed, use it to install Node.js:
nvm install nodeThis will install the latest version of Node.js. 🚀
Check the installed Node.js version:
node --versionNPM comes bundled with Node.js. Check its version to confirm:
npm --versionTo make the latest Node.js version the default for new terminal sessions:
nvm alias default node- If you face issues, make sure your terminal is reloaded by running:
source ~/.bashrc
- For permissions errors, use
sudowhere needed. ❗
- 🌐 Node.js Official Download Page
- 📚 Install and Uninstall Node.js on Ubuntu - This helped me learn the basics of Node.js installation!
- NVM Documentation
- Node.js Official Website
Happy coding! 🚀