Category: Node Js

  • Blog
  • Category: Node Js

Install Node Js from Ubuntu Packages

Install Node Js from Ubuntu Packages Introduction Node.js is a JavaScript platform for general-purpose programming that allows users to build network applications quickly. By leveraging JavaScript on both the front- and back-end, development can be more consistent and designed within the same system. Node JS is required to run the UI of the Explorer and interact with coin to fetch the data and insert the same into Mongo DB. There are several ways to install node js 1. Binary Installation. To install Node JS from Binary  click here 2. Installation from Source Code. To install Node JS from Source Code Click Here 3. Installation from Ubuntu Packages. we are going to install Node JS from Installation from Ubuntu Packages.  Install Node.js with Ubuntu Package Manager Step 1: To install Node.js, execute the following command in your terminal sudo apt-get install nodejs Step 2: install the Node package manager sudo apt-get install npm Step 3: Create a symbolic link for a node sudo ln -s /usr/bin/nodejs /usr/bin/node Step 4: Check the version $ node -v v0.10.25 $ npm -v 1.3.10 Install Node.js with Maintained Ubuntu Packages Step 1: Add the Node.js-maintained repositories to your Ubuntu package source list curl -sL https://deb.nodesource.com/setup | sudo bash – Step 2: install Node.js with apt-get sudo apt-get install nodejs Step 3: create a symbolic link for the node sudo ln -s /usr/bin/nodejs /usr/bin/node Step 4:  Check the version $ node -v v0.10.44 $ npm -v 2.15.0 If you see the versions displayed for node and npm, you have successfully compiled Node.js with npm from Packages.

Install Node Js From Source Code

Node Js – Installation Here we will study NodeJs installation in the different operating systems and in different ways. Depending upon our development environment we need to install node js from source code or via nvm in windows, mac, and Linux (Including AWS and Google Cloud). Our first topic will be a focus on how to install node js from source code in Linux, then we will discuss different other methods of installing node js in Windows, Ubuntu, and Mac Operating System Different Ways of Installing Node Js There are 4 ways of installing Node JS Installing Node Js From Source Code Install Node Js using NVM Binary Installation. Install Node Js from Binary. Click Here to Install Nodes Js From Binary Installation from Ubuntu Packages. To install Node Js from Ubuntu Packages click here Install Node Js From Source Code Node Js From Source Code can be installed easily in Linux and Mac. Installing node js from source code is not recommended in Windows. But if you still want to do that we will come up with a blog on that. Here we will see how to install Node Js in Ubuntu and Mac Operating System Install NodeJs from Source Code- Linux (Ubuntu) TO INSTALL THE NODE JS FROM Source Code FOLLOW THE BELOW STEPS. Open the Ubuntu terminal and execute the below commands. Your ubuntu system can be on Google Cloud, AWS Cloud, Digital Ocean or even your local machine. This post focuses completely just on Installation. But if you want to learn Node Js in detail like even creating your own NPM package you should refer this Node Js Complete Guide. Step 1: Update your apt repository sudo apt-get update Step 2: Install build-essentials sudo apt-get install build-essential openssl libssl-dev pkg-config Step 3: Change to the src directory cd /usr/local/src Step 4: Make a node directory in your src folder sudo mkdir node Step 5: Enter the node directory cd node Step 6: Download the Source file of Node Js sudo wget https://nodejs.org/dist/v8.9.3/node-v8.9.3.tar.gz This URL downloads the specific version of node js. If you want to download the different versions of Node Js Source Code please change the URL accordingly. NodeJs source code is available in different sources. But the best method will be to download it from nodejs.org. Nodejs.org is the trusted website providing reliable and secure source code of Node Js. The source code of all the versions of Node is available and their link can be found in the website If you want to experiment with multiple version I will suggest that you should go for the nvm version manager. But if you production-ready application and you are sure of version then please read below points to get the required node js source code for your project. For 8.9.3 of Node Js Source Code Please click here 9.11.0 please use this link https://nodejs.org/dist/v9.11.0/node-v9.11.0.tar.gz But if you want to download the latest version your URL will be https://nodejs.org/dist/v9.11.0/node-v9.11.0.tar.gz If you different version requirement please see the list of the available version of Node Js in the link over here https://nodejs.org/en/download/releases/ Step 7: Extract the tar file sudo tar zxvf node-v8.9.3.tar.gz Step 8:Enter the Node Js Directory cd node-v8.9.3 Note: This folder contains raw files that need to be compiled specifically for your particular architecture and kernel. Most source code packages like this come with a bash script called “configure” that will create all these files and set the options for you. Step 8: Run the configure script sudo ./configure Note: If you don’t receive any errors or warnings, the configure script ran successfully. Step 9: Compile the code to Install Node Js From Source Code sudo make make will begin compiling the code. This will take 5-10 minutes or even longer depending on your server resources. Step 10: Now that make is compiled, install it sudo make install Step 11: Check the Node.js and npm version node –version npm –version If you see the versions displayed for node and npm, you have successfully compiled Node.js with npm from the source. Since your Node Js is installed, you can now begin installing node modules through npm. Next we will see how to install this in Mac Operating System But if you want to learn complete Node Js please refer to this link of Node Js. I think this is the best thing available on the internet if you want to explore and learn Node Js better than anyone. Install NodeJs using NVM The above method explains how to install node js from source code. But there are scenarios when you need to have multiple versions of Node Js. There are many such scenarios. Consider you are running two application which requires node 8.9 and other is an old application which requires node 6.1. To handles this we need to use NVM, Node Version Manager. Installing Node Js Using NVM in Ubuntu Here, we will install two versions of node js and we will also see which version is available with NVM. Just open your Ubuntu terminal and follow the below instructions Step 1: Install NVM in Ubuntu Open Your Ubuntu Terminal and do an update. This command is not necessary but if you have not done an update for along it’s better you do it now. sudo apt-get update Step 2: Install build-essentials Again this is also not necessary. But if NVM or Node Js is the first application in your system, then it’s a high probability that these packages are not installed in your system. It’s better to execute this command. If everything is installed system will just print the message that it’s already installed. sudo apt-get install build-essential libssl-dev Step 3: Getting the NVM Installation script using Curl Download the curl script of NVM installation by using below command in your ubuntu terminal curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash Since we have mentioned a specific version i.e. 0.34 please make a note that, you can modify it to the latest version. Just google which is the latest version of the Node Version Manager

Install Node JS From Binary

Install Node JS From Binary Node JS is required to run the UI of the Explorer and interact with coin to fetch the data and insert the same into Mongo DB. There are three ways of installing Node JS 1. Binary Installation. 2. Installation from Source Code. To install Node JS from Source Code Click Here 3. Installation from Ubuntu Packages. To install Node JS from Ubuntu Packages click here we are going to install Node JS from binary. To install the Node JS from binary follow the below steps step 1: Go to https://nodejs.org/en/download/  and copy latest Linux binary URL https://nodejs.org/dist/v8.9.4/node-v8.9.4-linux-x64.tar.xz step 2: Make a node directory in your src folder sudo mkdir node Step 3: Enter the node directory cd node step 4: Unzip and extract the binaries sudo tar xvf node-v8.9.4-linux-x64.tar.xz –strip-components=1 -C ./node step 4: Make an etc directory in your node folder sudo mkdir node/etc Step 5: execute the following command sudo echo ‘prefix=/usr/local’ > node/etc/npmrc sudo mv node /opt/ sudo chown -R root: /opt/node step 6: Create a symbolic link for a node that points to the new directory sudo ln -s /opt/node/bin/node /usr/local/bin/node sudo ln -s /opt/node/bin/npm /usr/local/bin/npm step 7: Check the Node.js version node -v If you see the versions displayed for a node, you have successfully installed Node.js.