February 02, 2022

Ubuntu - update NPM and NodeJS

Hi folks,

Some people often confuses with NPM update vs Node.js update.

Let me clarify that, NPM (Node Package Manager) is a CLI (Command Line Interface) to manage the JS (JavaScript) packages from https://www.npmjs.com/ or any other external package managers like GitHub.

Node.js is a FrontEnd JavaScript Framework like Vue.js, AngularJS which helps to build the scalable network applications. Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.

NVM (Node Version Manager) and n are command line utilities to manage and switch between Node.js versions.

When you are installed for the first time, you will be installing Node.js from https://nodejs.org/en/download/ which also installs NPM CLI utility.


But when upgrading the NPM or Node.js, it's a different story.


Update NPM

npm install -g npm

Update Node.js with Node version manager (n)

Install the n

sudo npm install -g n

Update the Node.js to stable version

sudo n stable

As of now, the stable version is 16.3.2 which includes NPM 8.1.2

Update the Node.js to current version

sudo n current

As of now, the current version is 17.4.0 with NPM 8.3.1


Check the versions

NPM

npm --version

Node.js

node --version


Hope this helps you to understand the NPM and Node.js difference along with update of individual components.

Send your comments and feedback to psrdotcom@gmail.com

 

Featured Post

Java Introdcution

Please send your review and feedback to psrdotcom@gmail.com