How to Install Node.js on Ubuntu 16.04

First, make sure you have a C++ compiler. Open the terminal and install the build-essential and libssl-dev packages if needed. By default, Ubuntu does not come with these tools — but they can be installed in the command line.

Image result for nodejs

Use apt-get to install the build-essential package:
sudo apt-get install build-essential checkinstall

Employ a similar process to get libssl-dev:

sudo apt-get install libssl-dev
You can install and update Node Version Manager, or nvm, by using cURL

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
You will be asked to close and reopen the terminal. To verify that nvm has been successfully installed after you reopen the terminal, use:

command -v nvm

That command will output nvm if the installation worked.

To download, compile and install the latest version of Node:

nvm install 5.0
In any new shell, you’ll need to tell nvm which version to use:
nvm use 5.0 

To set a default Node.js version to be used in any new shell, use the alias default:
nvm alias default node
Not only does nvm allow you to run newer versions of Node.js and npm, you can install and migrate any desired versions you’d prefer. Go to the nvm GitHub repository for more information.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: