Downloading and installing Node.js and NPM

  • avatar
  • 1.5K Views
  • 1 Like
  • 4 mins read

NPM stands for Node Package Manager, which is an application and repository for developing and sharing JavaScript code. To publish and install packages to and from the public NPM registry or a private NPM registry, you must install Node.js and the NPM command line interface using either a Node version manager or a Node installer.

Node.js is a run-time environment which includes everything you need to execute a program written in JavaScript. It’s used for running scripts on the server before it is delivered to a web browser. As a result, you can develop frontend and backend solely using JavaScript. Node.js is designed to build scalable network applications.

Installing Node.js

Download the Node.js source code or a pre-built installer for your platform.

OS X or Windows Node installers

If you're using OS X or Windows, use one of the installers from the Node.js download page. Be sure to install the version labeled LTS. This LTS version is recommended to most users because of its sustainability and 18-month-long support cycle.

Linux or other operating systems Node installers

For Linux, use one of the following installers:

  • NodeSource binary distributions as well as their setup and support scripts (recommended)

    To install current LTS version of Node.js with apt package manager using Ubuntu:

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


    To install current LTS version of Node.js with apt package manager using Debian, as root:

    curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
    apt-get install -y nodejs
  • One of the installers on the Node.js download page

Less-common operating systems

For more information on installing Node.js on a variety of operating systems, see this official page.

Installing NPM

To download the latest version of NPM, on the command line, run the following command:

npm install npm --location=global

npm_installation.png

It will install the NPM package manager globally on your machine.

Checking your version of NPM and Node.js

If you already have Node.js and NPM installed you can check their versions with the commands below. It also serves to verify a recent installation and make sure that you have the needed version.

Check the installed Node.js version:

node -v

node_v.png

Check the installed NPM version:

npm -v

npm_v.png

If Node.js and NPM are installed correctly, you’ll see respective version names on the terminal as shown on the images.

 Join Our Monthly Newsletter

Get the latest news and popular articles to your inbox every month

We never send SPAM nor unsolicited emails

0 Comments

Leave a Reply

Your email address will not be published.

Replying to the message: View original

Hey visitor! Unlock access to featured articles, remove ads and much more - it's free.