How to install the previous version of node.js and npm ?

Node.js: It is a JavaScript runtime(server-side) built on V8 JavaScript engine of Google Chrome. It was developed in 2009 by Ryan Dhal. Node.js uses an event-driven, non-blocking input/output model that makes it lightweight and efficient. It is perfect for data-intensive real-time applications. Node is like a wrapper around the V8 with built-in modules providing many features that are easy to use in asynchronous APIs.

NPM: NPM(Node Package Manager) installs and manages version and dependency of packages for Node.js. NPM is installed with Node. The aim of NPM is automated dependency and package management, anytime or anyone needs to get started with the project they can simply rum NPM install and all the dependencies they will have immediately. It is possible to specify which version your project depends upon to save your project from breaking due to updates.

Installing the previous version of Node.js and NPM: To install the previous versions from the latest version, the latest version of Node.js should be installed on your computer or you can install it from the official site of Node.js.

Step 1: Check the installed version of Node and NPM on the computer use the following command respectively

  • In windows:
    node -v



    npm -v

  • In linux:
    node --version
    npm --version

Step 2: For installing the previous version of Node use the following command:

  • In windows:
    npm install -g node@version

    Example:

    npm install -g node@10.9.0 

  • In linux:
    sudo  apt-get install nodejs=version-1chl1~precise1

    Example:

    sudo  apt-get install nodejs=10.9.0-1chl1~precise1

Step 3: To install previous version of NPM use the following command:

  • In windows:
    npm install -g npm@version 

    Example:

    npm install -g npm@4.0.0

  • In linux:

    sudo  apt-get install npm=version-1chl1~precise1

    Example:

    sudo  apt-get install npm=4.0.0-1chl1~precise1

full-stack-img

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. 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.