Install NPM on Ubuntu 24.04

The Node Plan Manager (NPM) is a device that permits developers to mount and work with various JavaScript packages efficiently. Setting up NPM entails installing Node.js, and this post shares all the insights you require to mount NPM.Node.js is an ideal alternative for any individual seeking to have a scalable backend that uses JavaScript. Node.js is built on Chrome’s V 8 JS engine, and you can conveniently install it on your Ubuntu 24 04 to begin powering your backend performance in your jobs. We will concentrate on recognizing three choices for mounting NPM on Ubuntu 24 04

Technique 1: Mount NPM on Ubuntu 24 04 via APT

You can find the NPM and Node.js from the Ubuntu repository. If you do not need any type of particular Node.js version for your job, you can use this choice to set up NPM and Node.js with the listed below commands.

First, run the update command.

Next, resource Node.js from the default database and install it making use of the command listed below.

$ sudo appropriate mount nodejs

At this moment, you have Node.js mounted, and you can verify the mounted version utilizing the command listed below.

To mount NPM, run the following command.

Confirm that NPM is mounted by checking its variation.

We have npm v 9 for our instance. You can now pleasantly start working on your Node.js job, and with NPM installed, you have space to install any kind of dependencies or plans.
That’s the first option of installing NPM and Node.js on Ubuntu 24 04

Technique 2: Mount NPM Using NodeSource PPA

When you set up the NodeSource bundle, it will certainly install NPM without you requiring to mount it independently. This approach permits you to set up a specific Nodejs bundle given you’ve properly included the PPA by downloading it using wget or crinkle

Begin by visiting the Nodejs project to see which version you wish to set up.

As soon as you decide on the variation, fetch it utilizing crinkle as in the complying with command. For our instance, we have actually retrieved variation 20 x

$ crinkle sL https : // deb.nodesource.com/setup_ 20 x -o nodesource_setup. sh

The script will get saved in your current directory site, and you can verify it making use of the ls command.
The following step is to run the manuscript, but before that, you can open it with a text editor to validate that it is risk-free to perform.

You can then run the manuscript using bash with the adhering to command.

$ sudo celebration nodesocurce_setup. sh

The command will include the NodeSource PPA to your local bundle, where you can resource and mount Node.js. When the script completes executing, you will obtain an output validating the PPA has been included, and it will certainly present the command you ought to utilize to install Node.js.

Note that before installing the Node.js package, if you have already installed it making use of the previous technique, it’s best to uninstall it to avoid facing an error. To do so, use the below command.

$ sudo suitable autoremove nodejs npm

To mount the Nodejs bundle, which will certainly also mount NPM, run the complying with command.

$ sudo suitable mount nodejs

Your system will source the bundle from the regional bundle where we added the PPA. It will then continue to mount the NodeSource bundle variation that you downloaded.

When the setup is total, examine its variation making use of the following command.

The result will present the node variation you downloaded, which is v 20 12 2 for our situation. Still, if we examine the mounted NPM variation, you will discover it’s different from what we had earlier.

The PPA set up NPM v 10 5.0, which is higher than what we installed in method one earlier.

Verdict

For any person wanting to use NPM and Node.js to power their backend application, this article shares two various methods for perfectly setting up NPM. This permits you to run your Node.js and set up packages properly. You can set up NPM from the default Ubuntu 24 04 repository or include its PPA from the Node Source task, which will automatically mount NPM together with Node.js.