How To Update Npm On Linux and Windows?
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 Fedora, CentOS, RedHat
yum based distributions we will use
dnf command like below where we will install
$ sudo yum install npm
$ sudo dnf install npm
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
We can see that the current major version of the installed npm is
5 and the minor version is
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 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 update npm
$ dnf update npm