...

Table of Contents

Popular Category

How To Install npm & Node.js On Windows

How To Install npm & Node.js On Windows?

The Basics


Javascript has become one of the most popular cross-platform languages. It is the number one choice for developers aiming to create a full-fledged application. It can be used with different frameworks and environments, allowing for building a solid backend, alongside the front-end.

One of the most popular runtime environments for the language is Node.js, which is great for creating server-sided applications, regardless of the scale. It allowed JavaScript code to be executed outside the browser, allowing for creation of web apps. Built on the JavaScript runtime on Chrome V8, Node.js allows for fast development of network applications. Even world-leading businesses utilize it. Some of the most popular applications are:

This might give you an idea of the versatility of the programming framework, which is even more popular than PHP since 2022.

What Is npm?


npm stands for Node Package Manager. In layman’s terms, it is an online repository that contains a large number of JavaScript software packages. It can be operated via command line too, making installation of the packages and management of their dependencies faster.

The main attraction of npm is, it’s free. It is trusted by more than 11 million developers worldwide, giving you an idea of just how dependable it is. As of September 2022, the npm registry reported hosting over 2.1 million packages!

Why Should I Use npm?


Managing packages and their dependencies is certainly a tedious task. It can take hours, which results in slow development. In the case of npm, it handles everything for you, making managing dependencies as simple as typing in the npm install command.

All you need to do is define all required dependencies in a package.json file, and the above given code handles the rest!

 

What Is A package.json?


A package.json file not only has a list of all dependencies needed for successful application execution but it also hosts other important data. Typing npm init allows you to initialize the file with:

  • Name – Your project’s name
  • Version – Current version along with the patch
  • Description – A brief description of the project or the new patch
  • License – All licenses the project is under

When you open a package.json file, it shows in a similar format to this:

{

“name”: “My JavaScript Project”,

“version”: “0.9.3a”,

“description”: “A basic implementation of a calculator”,

“main”: “index.js”,

“directories”: {

“abc”: “abc”

},

“scripts”: {

“start”: “node index”,

},

“license”: “Academic Free License v1.1

}

 

How To Use npm Scripts?


You might have noticed in the code block above, npm scripts contain scripts. These scripts are responsible for bundling common shell commands for your project. Some common use-cases of these scripts are:

  • Building your project
  • Testing your application

The respective scripts for these commands are:

  1. “scripts”:{

“build”: “webpack –mode production”

}

  1. “scripts”:

{ “test”: “mocha”

}

 

Installing npm On Windows


Installing npm in Windows is a surprisingly easy task. You don’t have to spend any time in front of a CLI (command-line interface), making the process seamless.

 

Minimum Requirements


There are no specified requirements provided, which means Node.js can run on almost all computers. This means it can be used on devices such as the Arduino YÚN, which is commonly utilized for IoT projects.

Still, if you are looking for some basic requirements that will ensure smooth running of the environment, you can consider these:

  • 4GB RAM
  • Minimum of Intel Core i3 processor @ 2.5 GHz or higher
  • 256 GB of Free Storage Space

 

How To Install npm On Windows


The general overview of the steps for installing npm are as follows:

  1. Go to the following official npm download link:

Node.js — Download Node.js® (nodejs.org)

  1. Click on prebuilt installer and download the latest version
  2. Go through all the steps on the npm installer
  3. Choose your desired installation folder
  4. Choose required packages
  5. Click on install

The process really is that simple.

Let’s take a look at the installation process, for Windows, in more detail:

  1. Choose the version you want; alongside the OS you want it for

  1. Click on the installer

  1. Choose the desired installation directory. Make sure that the drive you install it on has sufficient space.

  1. Choose all required packages. You can see that npm is bundled together with the installer.

  1. Click on install

Now you have learned how to install Node and npm on the Windows operating system.

 

How To Install npm On Mac

When it comes learning how to install Node.js on Mac, there are three different methods to do so.

Method # 1 – Using The Installer

  1. Head on over to the same installation page:

Node.js — Download Node.js® (nodejs.org)

  1. Choose the version you need and select macOS from the dropdown.
    Choose x64 if your Apple Mac has an Intel chip inside. Otherwise, choose Arm64.
  1. The rest of the installation process is similar to how it was done on Windows. Press continue and proceed to install Node.js and npm.

You have successfully learned how to install Node.js on Mac. Using an installer makes things a lot more streamlined. But there is a better way to do it! Take a look at the second method below.

 

Method 2 – Using Homebrew To Install Node.js on MacOS


Homebrew is a must addition to your list of additions in MacOS. It is a package manager that allows a person to install, update, and manage a majority of installed applications on their machine.

How To Install?

The process is fairly straightforward once you have Homebrew installed.

  1. Open terminal
  2. Type in this command: brew install node
  3. That’s it! This command will install everything you need to hit the ground running with Node.js and npm.
 

How To Verify Your Node.js Installation

How To Check Node.js Version On Windows


Once installed, you can check your Node.js and npm version using Windows’ built-in terminal, CMD.

  1. Type in: node -v for the Node.js version
  2. Type in: npm -v for your installed npm version
 

How To Check Node.js Version On Mac


Once installed, open terminal and type:

1.  Node –version and press enter
2.  npm –version and press enter You’ll be able to see the installed versions of both, verifying the installation.

Conclusion


Installing npm on Windows or Mac is as simple as clicking on a file and clicking on a few more buttons. If you are new to the world of node.js, make sure to take a look at some tutorials and courses to start your web app development journey. We hope this blog was informative and helped you install npm on your Windows machine!

Related articles

Best Practices for Remote Software Development Teams in 2024
Software Development

Best Practices for Remote Software Development Teams in 2024

Remote work has become the norm in the software development …

What Is The Difference Between TypeScript And JavaScript
Comparisons

What Is The Difference Between TypeScript And JavaScript

When it comes to web development, two languages often stand …

hidden cost of bad code
Software Development

The Hidden Cost of Bad Code – Why Quality Matters in Software Development

In the world of software development, the phrase “just get …

Scroll to Top

Request A Meeting