How To Update Npm On Linux and Windows? – POFTUT

How To Update Npm On Linux and Windows?


NodeJS is a popular application development and deployment framework written in Javascript programming language. It provides server-side libraries and functionalities to accomplish tasks. Npm is the NodeJs Package Manager which is used to install, update, delete packages to the current application. In this tutorial, we will learn how to update npm in different operating systems like Ubuntu, Debian, Mint, Kali, CentOS, RedHat, Fedora, Windows, Windows Server etc.

Install Npm Package For Ubuntu, Debian, Mint, Kali

We can install npm package with the apt command where Ubuntu, Debian, Mint, Kali distributions support.

$ sudo apt install npm
Install Npm Package For Ubuntu, Debian, Mint, Kali
Install Npm Package For Ubuntu, Debian, Mint, Kali

Install Npm Package For Fedora, CentOS, RedHat

For yum based distributions we will use yum or dnf command like below where we will install npm package.

$ sudo yum install npm

OR

$ sudo dnf install npm
Install Npm Package For Fedora, CentOS, RedHat
Install Npm Package For Fedora, CentOS, RedHat

Print Npm Version

Before updating the npm we will print the current npm version. We will use -v option which will print major and minor version information about npm.

$ npm -v
Print Npm Version
Print Npm Version

We can see that the current major version of the installed npm is 5 and the minor version is 8 .

Update On Windows, Linux (Ubuntu,Debian,Mint,CentOS,RedHat,Fedora)

After installing the npm package or executable we can use npm command to update npm. We will use install option with the -g option and npm@latest like below.

$ npm install -g npm@latest
Update On Windows, Linux (Ubuntu,Debian,Mint,CentOS,RedHat,Fedora)
Update On Windows, Linux (Ubuntu,Debian,Mint,CentOS,RedHat,Fedora)

Update On Ubuntu, Debian, Mint, Kali with Package Manager

deb based distributions like Ubuntu, Debian, Mint, Kali provides apt tool in order to update installed packages. We can use update option with the npm package like below.

$ sudo apt update npm

Update On Fedora, CentOS, RedHat with Package Manager

We can update npm package with the following yum or dnf commands.

$ yum update npm

OR

$ dnf update npm

LEARN MORE  How To Install Nodejs Into Linux (Ubuntu, Debian, Fedora, CentOS, RedHat)?

1 thought on “How To Update Npm On Linux and Windows?”

Leave a Comment