Jeff Flowers / 08 June 2015 / Tutorials / 17615

Node.js and the NPM package manger are powerful tools, allowing for rapid prototyping on one’s own computer system as though it were the end server containing your web application. The following is a beginner’s guide to installing these tools on a Mac 10.10.3 system. It assumes no prior knowledge. Enjoy and get developing.

Overview:

  1. Procuring the Node.js
  2. Installing the Node.js Software
  3. Verifying the Installation Process
  4. Installing Packages Using npm

1. Procuring Node.js

  1. Go to the following website:  https://nodejs.org/
    Node.js website
  2. Select the “Install” button. This should automatically begin the download of the appropriate binaries for your system.
    install node.js button
  3. Verify that your system is downloading the software.
    Verify node.js download
  4. The package will be downloaded into your default “Downloads” folder.  Once it is completely finished, open the package to begin the installation process.
    node.js download complete

2. Installing the Node.js Software

  1. Go through the various steps, as shown in the installer window that appears.
    Node.js installation window
  2. You will need to select “Install for all users of this computer” in order for the installer to continue.
    Node.js installation select all users
  3. Make a note of the final installation window.  The $PATH should be correctly configured, if not this can be manually corrected.
    node.js installation path

3. Verifying the Installation Process

  1. Open the Terminal application, in order to double check that the installation was successful.
    Open terminal
  2. To check that both node and npm (the package manager) has been installed and configured for you system, type the following commands:

    >npm --version <enter>
    >node --version <enter>

  3. If your system has had the software installed correctly, you should see the correct version numbers of the software.
    Verifying installed versions

4. Installing Packages Using npm

The power of Node.js rests in the large library of software that has been created for this tool.  These packages extend the abilities of the platform and allow one to then develop atop.

  1. Packages are installed and made available to Node.Js though a package manager called, npm.
  2. npm’s function is to download all of the necessary software to permit a package to operate as well as make all necessary links.

  3. npm has two modes of installation:
    1. Local
      • Local install is used during development.
      • Useful when you need to sandbox development to ensure that your other projects.
      • The syntax for a local install is within Terminal:
        >npm install PACKAGE <enter>
    2. Global
      • Some packages will be used for multiple projects, making these globally available is more convenient.
      • The syntax for a global install is (within Terminal):
        >npm install –g PACKAGE <enter>
  4. Once a package has been installed, you can use it in your programs.

 

Add comment


Security code Refresh

Talk to Us!

Get a quote, give us suggestions, or send us a hello :)

816.983.6923

San Mateo, California

PGP: 20AE A7E7 6CA8 F81B 4FB1 C942 BA34 7830 1DEB 320E