Installing NodeJS and npm

Posted by admin at January 20, 2017

Node.js is an open source Javascript runtime framework, designed for the development of scalable, full-stack front-end and back-end applications entirely on the JavaScript language. There are lot of cool stuff that can be done with this tool, a node web server and IoT being some of them.

However, I am also interested in its package tool called the npm or the Node Package Manager, an online repository of tons of open-source NodeJS libraries and applications as well as a command-line tool for installing these packages, version control, and dependency management. The complete list of these packages and what each does, can be searched for on http://search.npmjs.org/.

Installing it

Go to the NodeJS download site and download the appropriate package installer or binary for your system. Run the application to install NodeJS and the package manager, npm. Simple as that.

Testing the installation:

Type ‘npm’ into terminal and you should get the following


Usage: npm 

where  is one of:
    access, adduser, bin, bugs, c, cache, completion, config,
    ddp, dedupe, deprecate, dist-tag, docs, edit, explore, get,
    help, help-search, i, init, install, install-test, it, link,
    list, ln, login, logout, ls, outdated, owner, pack, ping,
    prefix, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, tag, team, test, tst, un, uninstall,
    unpublish, unstar, up, update, v, version, view, whoami

npm  -h     quick help on 
npm -l           display full usage info
npm help   search for help on 
npm help npm     involved overview

Specify configs in the ini-formatted file:
    /Users/bg-air-mac/.npmrc
or on the command line via: npm  --key value
Config info can be viewed via: npm help config

npm@3.10.10 /usr/local/lib/node_modules/npm

Installation Log for Latest LTS Version: v6.9.4 with npm 3.10.10:

  1. Downloaded package for Mac OSX 64-bit.
  2. Ran the installer. Note: The message below was displayed on the first step of the installation dialog
    
    This package will install Node.js v6.9.4 and npm v3.10.10 into /usr/local/.
    
  3. Followed the dialog till the end. The Summary section displayed after the installation has the following message
    
    Node.js was installed at
    
       /usr/local/bin/node
    
    npm was installed at
    
       /usr/local/bin/npm
    
    Make sure that /usr/local/bin is in your $PATH.
    
  4. So I checked if “/usr/local/bin was in my $PATH”

    Open terminal and entered the line

    
    echo $PATH
    

    Results:

    
    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
    

    If the results above did not show, the line below would resolve it

    
    export PATH=$PATH:/usr/local/git/bin:/usr/local/bin
    
   0 likes

Suggested Read