Install npm on Ubuntu 16.04


Install npm on Ubuntu 16.04
Installing npm on Ubuntu 16.04, is an easy task, just follow the steps bellow and you should have successfully installed npm on a Ubuntu 16.04 VPS Server. npm is a JavaScript package manager which can be used to install, share, and distribute code as well as to manage dependencies in your projects. It is written entirely in JavaScript as an inspiration from the other similar projects like PEAR for PHP or CPAN for Perl.

1. Connect via SSH and Upgrade your System

The very first thing you need to do is to connect to your Linux VPS via SSH and upgrade your system software to the latest version available. You can do that by using the following command:

sudo apt-get update && sudo apt-get -y upgrade

The upgrade process could take from few seconds to few minutes depending on the software that needs to be upgraded. Once your system is up to date, you can proceed with the other steps of this tutorial.

2. Install Node.js

npm is bundled with Node.js, so to install npm you only need to install Node.js on your Ubuntu VPS. To install Node.js 4.x LTS on Ubuntu 16.04, run the following commands:

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

Alternatively, to install Node.js 6.x on Ubuntu 16.04, which is the current version of Node.js, run the commands below:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

3. Verify npm Installation

To verify that the installation is successful you can check the version of npm:

npm -v

The output should be similar to the one below:

# npm -v
2.15.9

4. Check npm Help Documentation

A good way to start using npm is to read the npm help page or the npm documentation. To check the npm help page, enter the following command:

npm help

Here is the npm help page:

# npm help

Usage: npm <command>

where <command> is one of:
    access, add-user, adduser, apihelp, author, bin, bugs, c,
    cache, completion, config, ddp, dedupe, deprecate, dist-tag,
    dist-tags, docs, edit, explore, faq, find, find-dupes, get,
    help, help-search, home, i, info, init, install, issues, la,
    link, list, ll, ln, login, logout, ls, outdated, owner,
    pack, ping, prefix, prune, publish, r, rb, rebuild, remove,
    repo, restart, rm, root, run-script, s, se, search, set,
    show, shrinkwrap, star, stars, start, stop, t, tag, team,
    test, tst, un, uninstall, unlink, unpublish, unstar, up,
    update, upgrade, v, version, view, whoami

npm  -h     quick help on 
npm -l           display full usage info
npm faq          commonly asked questions
npm help   search for help on 
npm help npm     involved overview

Specify configs in the ini-formatted file:
    /root/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

[email protected] /usr/lib/node_modules/npm <command>

The npm documentation is available at https://docs.npmjs.com/.

Instal npm on Ubuntu 16_04

Of course, you don’t have to install npm on Ubuntu 16.04  if you use one of our Linux VPS hosting services, in which case you can simply ask our expert Linux admins to  install npm on Ubuntu 16.04. They are available 24×7 and will take care of installing npm on Ubuntu 16.04.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Tutorials
Install Cockpit CMS on Ubuntu 16.04
Tutorials
How To Install Webmin on CentOS 7
Tutorials
How to Setup an Email Server with Mail-in-a-Box on Ubuntu
  • Arunaday

    ArunadayArunaday

    Author Reply

    I think you can upgrade the post to Node version 7 now.


  • Ron

    RonRon

    Author Reply

    Its better to install node with nvm, no more sudo problems…Its


 
Free Migration to RoseHosting. Award Winning Linux VPS Hosting with Fully Managed Support. Coupon RHBLOG50 for 50% offOrder Now
+