Install Nodejs on Centos 7

Node.js is a Javascript platform for server-side programming. It allows users to easily create networked applications that require backend functionality. By using Javascript as both the client and server language, development can be fast and consistent.

First I’ve tried to install Node using yum package installer ( epel repository ), but it didn’t install latest Node and npm versions. To after some investigation I decided to install Node using nvm package installer.

Installation is quite simple and  straight forward and didn’t raise any new issues – to my surprise.

Nodejs

NVM package repository is at https://github.com/creationix/nvm.

To begin installation ( or update nvm ) use install script 

wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

Script will clone nvm repository to ~/.nvm and add source lines to your profile. Details on installation specifics you can find on repository home page.

Important: After installation close the terminal, and reopen new session.

Note: On Linux, after running the install script, if you get nvm: command not found or see no feedback from your terminal after you type: 

command -v nvm

Install Node and npm

To install latest node release just enter :

nvm install --latest-npm

After installation check node and npm versions

[[email protected] ~]$ node -v
v10.9.0
[[email protected] ~]$ npm -v
6.4.0

NVM installation gives option to use several Node versions, but for this you need to specify which node version your project will use.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.