8

How to update Node.js and NPM to next version ? - GeeksforGeeks

 3 years ago
source link: https://www.geeksforgeeks.org/how-to-update-node-js-and-npm-to-next-version/?ref=leftbar-rightbar
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How to update Node.js and NPM to next version ?

Last Updated: 30-06-2020

Node.js is a cross-platform JavaScript environment that can be used for server-side scripting. Due to its non-blocking workflow, Node.js is popular among the web developers for building a dynamic web application. Node Package Manager also known as npm is the package manager for Node.js. It also serves as a command-line utility for interacting with the npm online repository for package installation, version management, and dependency management. It is important to have Node.js installed in order to use npm. Also, working with updated versions of Node.js and npm ensures better performance and added features.
Follow the link to download and install Node.js: Download Node.js

Update Node.js to the latest stable version: Node.js can be updated from the official Node.js website as well as through the command line using Node Version Manager(nvm). nvm was originally developed for Linux systems, however nvm can be installed separately for Windows system by the following steps:

  1. Go to this site
  2. Install and unzip the nvm-setup.zip file
  3. From cmd type nvm -v to ensure nvm is installed.

After installing nvm, the following can be done to update Node.js to the latest version:

nvm install <version>
Node_nvm.png
Check the list of available Node.js version in the system using the following command:
nvm list 

To use the desired version, use the following command:

nvm use <version>
node_use.png

Update npm: To update NPM, use the following command:

npm install -g npm

Output:

npm3.png

Below is a demonstration for updating Node.js and npm versions for Linux systems.
Install nvm in Linux:

# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
OR
# wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash

Check if nvm is installed successfully

Open a new terminal
nvm -v

To install latest version of node, use the following command.

# nvm install node
or
# nvm install -lts
or
# nvm install 
download_node1.png
node_lts1.png

Check all the available version of node on the system:

# nvm ls
nvm-ls1.png

Use a particular version

# nvm use 
nvm-use.png
Update npm to latest version:
# npm install -g npm 
npmupdate1.png
full-stack-img

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :
thumb_up
Be the First to upvote.
0

No votes yet.
Please write to us at [email protected] to report any issue with the above content.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK