Surender Thakran
Surender Thakran

Reputation: 4054

How to backup my Node.js setup when upgrading

I want to upgrade Node.js on Ubuntu, but I want to make sure that if anything goes wrong I could revert back my source code, installed modules and node binary to the working setup. How to achieve that?

Upvotes: 3

Views: 561

Answers (2)

Amol M Kulkarni
Amol M Kulkarni

Reputation: 21639

You can install any version of node.js just go to downloads. Go into Other Releases and download what version you want with respect to your OS and 32-bit or 64-bit. Example:

  • node-vX.XX.X-OS-x64.tar.gz (64-bit)
  • node-vX.XX.X-OS-x86.tar.gz (32-bit)

Then, follow the instruction on the github.com. Building and installing Node.js

Another way is to use NVM, the Node Version Manager (it works in a very similar way to rvm for ruby). This allows to install and manage multiple versions of node. Here's a snippet (source):

Usage:
nvm install <version>       Download and install a <version>
nvm use <version>           Modify PATH to use <version>
nvm ls                      List versions (installed versions are blue)

You can also check this n. A Simple flavour of node binary management.


Update (as per comments):
If you have installed the nvm after node.js. You can check already installed by using nvm ls which lists already installed version(s) ready to use.

amolkulkarni@ubuntu:~$ nvm ls
current: v0.10.18

Upvotes: 6

Krasimir
Krasimir

Reputation: 13539

You should use Node Version Manager https://github.com/creationix/nvm

Upvotes: 2

Related Questions