Category Archives: Node JS

Install or Upgrade to latest Node JS version in Ubuntu

Node Js

Node JS

We can install Node JS or upgrade currently installed version to latest version via two methods

  1. Installing latest .tar file and
  2. Node Version Manager (NVM)

Installing Node JS via .tar file

Download the latest version from https://nodejs.org/en/

At the time of writing this tutorial current version of node js is 8.11.3 LTS.

Now add it to environment variable bu running below command

Check the version of node js

Installing / upgrading Node Js via NVM

Other way to install / upgrade Node Js is via NVM (Node Version Manager) 

If it is not already installed on your machine, then follow below steps to install it, skip it already installed. You can also check these steps in the official documentation of NVM here

Run the script

Now source the profile to get the access in the current session which doesn’t require you logout and login back.

To see the list of versions available for installation run below command

To install a version that you need

Tell nvm to use currently installed version

Confirm the currently installed version by

 

Install or update nodejs usin NVM in Ubuntu

Node JS is a JavaScript runtime built on Chrome’s V8 JavaScript engine. Node.js uses an event driven, non-blocking I/O model that makes it lightweight and efficient
 Using nvmNVM, which stands for “Node.js version manager” we can install multiple versions of nodejs on Ubuntu.

To install or update nvm, you can use the install script using cURL: ( You can find the installation instructions on projects github page https://github.com/creationix/nvm/blob/master/README.md)


or using Wget:


Run the script by running 


To get the list of available Node.js versions

npm install – Please try running this command again as root/Administrator

If you are getting this error while running npm install, then you are not having write permission on .npm directory.

To get the ownership of this directory run following command

Also we need to give write permission to node_modules directory

ref – http://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo