How to install npm in Linux 2022

Posted by
How to install node js

How to install npm in Linux

Before strat how to install npm. We need to know about npm. Npm is the largest Software library in javascript. It is also a software package manager and installer. It is totally free. Npm is open-source software. It is a company established in 2014. It is a package manager for Node.js. You can check their code on Github. You can check npm open Source. Now start how to install npm

It is a Registry of a public collection of packages of open-source code for Node.js, front-end web apps, mobile apps, robots, routers, and countless other needs of the JavaScript community. npm is the command-line client that allows developers to install and publish those packages.

How to install npm in Linux? (ubuntu base)

You can install npm in Linux using this command. First, open your computer terminal. You can start the terminal manually or using this command.

Ctrl > Alt > T at the same time. Your terminal will be run. When your terminal starts completely, command this line.

Now install node.js on your computer using this command:

sudo apt install nodejs

Now check the NPM version:

npm -v

You can check the node.js version:

node -v

Sometimes node.js doesn’t install on some computers. It isn’t a problem. You need to update your apt. 

Read more: Linux Lite Review 2022

Upgrade the apt using this command:

sudo apt-get update

sudo apt-get upgrade

Then install the node.js now. I hope it will be solved.

Method 2:

There is another method you can install node.js using this way.

First, you need to install python for this.

Install python using this code:

sudo apt-get install python-software-properties

Now download node.js using this command:

curl -sL | sudo -E bash –

Note: Here, we are installing node.js version 17, if you want to install a newer version, you can replace setup_17.x with setup_18,19….x.

Now install it on your pc using this command:

sudo apt-get install nodejs

Check Node version:

node -v

npm -v

One comment

Leave a Reply

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