tips on how to set up Node.js on Ubuntu 14.04

0

Node.js, a JavaScript-based platform, is an an increasing number of widespread, lightweight, and efficient possibility for developers. It permits coders to use JavaScript on each the entrance-finish and the back-end thanks to Google’s superior V8 engine. With more than 100,000 applications, Node package manager, or npm, is a fantastic solution to to find open-source solutions for extending Node and npm’s semantic versioning device, which allows for terribly tight regulate over what packages you’re the use of. 5 how to install Node.js on Ubuntu There are a couple of ways to try this, but we recommend option 1: Node version manager (nvm). here is the full list of options: possibility 1 (Our pick!): set up the nvm script to regulate more than one energetic Node.js variations option 2: install the usual Debian/Ubuntu programs for Node and npm possibility 3: set up from Debian/Ubuntu programs created by the Node.js (related) group possibility 4: install Node.js manually from usual binary applications on the professional web site option 1 is our advisable method for everybody. possibility 2 is incredibly simple, whereas options 3, 4, and 5 have the good thing about conserving your Node and npm programs the most present. ahead of trying any of those install options, you’ll need to put off the previous Node package to avoid conflicts. And for any more knowledge on Node.js, you could always check up on the Github repository. before You Get began: cast off outdated Node bundle to steer clear of Conflicts On Ubuntu, the Node.js package has a an identical name to the older model, Node. The latter is an beginner packet radio program that you would be able to more than likely cast off. If you already have Node put in, chances are you’ll want to put off it. Some Node.js instruments may execute Node.js as Node as a substitute of Node.js, causing conflicts. that you can look for and dispose of the Node package by means of executing these commands in a terminal. To access a terminal, navigate via the pc menu: applications ? equipment ? Terminal Run this command and if it says set up in the best column, Node is for your gadget: 1 2 3 $ dpkg –get-alternatives grep node ax25-node                                       set up node                                            install for those who discovered the previous Node package deal installed, run this command to totally cast off it: 1 sudo apt-get remove –purge node possibility 1: set up Node.js with Node version supervisor First, be sure you have a C++ compiler. Open the terminal and install the build-very important and libssl-dev programs if wanted. via default, Ubuntu does not include these tools — but they are able to be installed within the command line. Use apt-get to install the construct-very important bundle: 1 sudo apt-get set up build-essential checkinstall rent a an identical course of to get libssl-dev: 1 sudo apt-get set up libssl-dev you can set up and update Node model manager, or nvm, via the usage of cURL: 1 curl -o- https://uncooked.githubusercontent.com/creationix/nvm/v0.31.0/install bash you’re going to be asked to close and reopen the terminal. to verify that nvm has been successfully installed after you reopen the terminal, use: 1 command -v nvm That command will output nvm if the installation worked. To download, compile and install the newest version of Node: 1 nvm install 5.0 In any new shell, you’ll wish to inform nvm which version to use: 1 nvm use 5.0 To set a default Node.js model to be used in any new shell, use the alias default: 1 nvm alias default node not handiest does nvm assist you to run more moderen versions of Node.js and npm, that you could set up and migrate any desired versions you’d want. Go to the nvm GitHub repository for extra knowledge. option 2: install Node.js with Ubuntu package deal manager to install Node.js, kind the following command in your terminal: 1 sudo apt-get install nodejs Then set up the Node package deal supervisor, npm: 1 sudo apt-get install npm Create a symbolic link for node, as many Node.js instruments use this title to execute. 1 sudo ln -s /usr/bin/nodejs /usr/bin/node Now we should have both the Node and npm commands working: 1 2 three 4 $ node -v v0.10.25 $ npm -v 1.3.10 choice 3: install Node.js with Maintained Ubuntu packages Add the Node.js-maintained repositories to your Ubuntu bundle source list sudo bash – Then set up Node.js with apt-get: 1 sudo apt-get install nodejs Optionally we will create a symbolic link for node (for reasons mentioned previous): 1 sudo ln -s /usr/bin/nodejs /usr/bin/node the usage of this set up option, we end up with more recent variations of Node.js and npm: 1 2 3 4 $ node -v v0.10.44 $ npm -v 2.15.zero possibility four: install Node.js with usual Binary applications Go to the reliable Node.js download page and obtain both the 32-bit or 64-bit Linux binary file, relying to your machine sort. you could determine the CPU structure of your server with these instructions: 1 2 3 4 $ getconf LONG_BIT sixty four $ uname -p x86_64 that you can download the file from the browser or from the console. The latter is shown below (be aware: the precise Node.js model might be totally different for you): 1 wget https://nodejs.org/dist/v4.four.4/node-v4.four.4-linux-x64.tar.xz To remember to can unpack the file, set up xz-utils: 1 sudo apt-get set up xz-utils subsequent, execute the following command to install the Node.js binary bundle in /usr/local/: 1 tar -C /usr/local –strip-elements 1 -xJf node-v4.four.four-linux.x64.tar.xz You must now have each Node.js and npm installed in /usr/local/bin. that you may test this with: 1 2 ls -l /usr/local/bin/node ls -l /usr/local/bin/npm last phrases hopefully this may increasingly get you going with Node.js on Ubuntu. in case you are new to growing applications with Node.js, the Nodeschool.io web site has a few fascinating tutorials.

Share.

Leave A Reply