Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine. It allows developers to create a wide variety of applications and tools using JavaScript. NPM, on the other hand, is a package manager for Node.js that allows developers to easily install and manage dependencies for their projects. In this article, we will explain how to install Node.js and NPM on Debian 11.
Before we begin, you will need to have a user account with sudo
privileges on your Debian 11 system. If you do not have one, you can create one by following these steps:
Log in to your Debian 11 system as the root
user.
Use the adduser
command to create a new user account:
adduser <username>
Replace <username>
with the desired username for your new user account.
Follow the on-screen instructions to set a password for your new user account and provide any other required information.
Use the usermod
command to add your new user account to the sudo
group:
usermod -aG sudo <username>
Replace <username>
with the username of your new user account.
Once you have a user account with sudo
privileges, you can proceed with the installation of Node.js and NPM.
To install Node.js and NPM on Debian 11, follow these steps:
Log in to your Debian 11 system as the user with sudo
privileges.
Use the curl
command to download the Node.js package from the official Node.js website:
curl -sL <https://deb.nodesource.com/setup_14.x> | sudo -E bash -
This command will download the latest stable version of Node.js (which is currently 14.x) and prepare it for installation on your system.
Use the apt-get
command to install Node.js and NPM:
sudo apt-get install -y nodejs
This command will install both Node.js and NPM on your system.
To verify that Node.js and NPM have been installed successfully, use the following commands:
node -v
This command should output the version number of Node.js installed on your system.
npm -v
This command should output the version number of NPM installed on your system.
That’s it! You have successfully installed Node.js and NPM on your Debian 11 system. You can now use these tools to create and manage your Node.js projects.
In conclusion, installing Node.js and NPM on Debian 11 is a simple process that can be completed in a few steps. By following the instructions in this article, you can easily set up Node.js and NPM on your system and start using them for your projects.