InfoHeap
Tech tutorials, tips, tools and more
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Node.js tutorials

  • Install node.js on Ubuntu Linux
  • Install node.js on Mac
  • npm tutorial
  • Debug javascript using node and Chrome
  • Find source file location of a module
  • Find version of installed package
  • How to use pm2 to manage node.js application in production
  • NestJS Quick start tutorial on Mac
  • NextJS Quick start tutorial on Mac
  • Fix cannot find module error
 
  • Home
  • > Tutorials
  • > Web Development
  • > Node.js

How to install node.js on Ubuntu Linux

By admin on Dec 22, 2015

Update node source

$ curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -

Check which nodejs will be installed

$ apt-cache policy nodejs
nodejs:
  Installed: (none)
  Candidate: 5.3.0-1nodesource1~trusty1
  Version table:
     5.3.0-1nodesource1~trusty1 0
        500 https://deb.nodesource.com/node_5.x/ trusty/main amd64 Packages
     0.10.25~dfsg2-2ubuntu1 0
        500 http://us-west-1.ec2.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages

Here candidate is 5.3.0-1nodesource1~trusty1 which is expected value.

Install node

This will install node and npm both.

$ sudo apt-get install nodejs
dpkg -L nodejs | grep /bin/
/usr/lib/node_modules/npm/node_modules/semver/bin/semver
/usr/lib/node_modules/npm/node_modules/which/bin/which
/usr/lib/node_modules/npm/node_modules/mkdirp/bin/usage.txt
/usr/lib/node_modules/npm/node_modules/mkdirp/bin/cmd.js
/usr/lib/node_modules/npm/node_modules/nopt/bin/nopt.js
/usr/lib/node_modules/npm/node_modules/request/node_modules/har-validator/bin/har-validator
/usr/lib/node_modules/npm/node_modules/request/node_modules/node-uuid/bin/uuid
/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
/usr/lib/node_modules/npm/bin/npm
/usr/lib/node_modules/npm/bin/npm-cli.js
/usr/lib/node_modules/npm/bin/npm.cmd
/usr/lib/node_modules/npm/bin/node-gyp-bin
/usr/lib/node_modules/npm/bin/node-gyp-bin/node-gyp.cmd
/usr/lib/node_modules/npm/bin/node-gyp-bin/node-gyp
/usr/lib/node_modules/npm/bin/read-package-json.js
/usr/bin/nodejs
/usr/bin/npm

Note that if you have older versions of legacy node packages installed (node-legacy, npm), it is better to remove them before installing latest nodejs from deb.nodesource.com.

Check the installation

$ dpkg -l nodejs
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                Version                Architecture           Description
+++-===================================-======================-======================-============================================================================
ii  nodejs                              5.3.0-1nodesource1~tru amd64                  Node.js event-based server-side javascript engine
$ node --version
v5.3.0
$ npm --version
3.3.12

Self update npm

To self update npm to latest version as npm installed with node may not be latest.

$ sudo npm install -g npm

Suggested posts:

  1. Ubuntu – find where will a package be installed from
  2. How to install node (node.js) on Mac
  3. node-sass quick start tutorial on Linux and Mac
  4. Install ffmpeg on Ubuntu Linux
  5. How to install phantomjs on Mac
  6. How to install AWStats on Ubuntu Linux
  7. How to install Imagemagick on Ubuntu Linux
  8. How to install phantomjs on Ubuntu Linux
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Javascript, Linux, Node.js, Tutorials, Ubuntu Linux

Follow InfoHeap

facebook
twitter
googleplus
  • Browse site
  • Article Topics
  • Article archives
  • Recent Articles
  • Contact Us
  • Omoney
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries

Copyright © 2023 InfoHeap.

Powered by WordPress