Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to backup my Node.js setup when upgrading

Tags:

node.js

ubuntu

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?

like image 776
Surender Thakran Avatar asked Dec 01 '25 09:12

Surender Thakran


2 Answers

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

like image 132
Amol M Kulkarni Avatar answered Dec 02 '25 21:12

Amol M Kulkarni


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

like image 24
Krasimir Avatar answered Dec 02 '25 21:12

Krasimir



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!