Npm for windows node js

Introduction

Node.js is a backend Javascript runtime environment that is light and highly scalable. It is used to build real-time applications such as video streaming applications. To make development easier, Node js developers created a node package manager (npm). This package manager acts as the Node.js command line. It is used for installing modules and initializing projects.

In this tutorial, you will learn how to install npm on Windows and how to use it.

Follow the steps below to download and install the Node.js .msi file. The Node.js .msi file includes the node package manager. You don’t have to download them separately like before.

  1. Go to the Nodej.s website and download the Long Term Support (LTS) version of Node.js. The LTS version has features that have abundant documentation and it is stable in terms of security and performance when compared to the Node.js current version.

  2. Navigate to the Download folder in the file manager and click the .msi package to start the installation procedure.

  3. Accept the terms in the License Agreement.

    alt_text

  4. Add a different directory if you want but you can just leave the default location set by Node.js.

    alt_text

  5. Select the Node.js features you want to install or remove by clicking on the drop-down list. You can leave everything on default if you don’t have any changes to make.

    alt_text

  6. Check the box to install essential tools required by Node.js and npm.

    alt_text

  7. Finish the installation process by clicking on the install button to install Node.js.

Confirming that npm and Node.js have been installed successfully

Use the npm -v command to check the version of the node package manager you just installed. You will get the version number if it has been successfully installed.

npm -v

8.1.0

Use node -v command to check if Node.js has been installed successfully. This command will also show the version number if Node.js has been successfully installed.

node -v

8.1.0

How to initialize a project using npm

The npm init command is used to create a Node.js project. The npm init command will create a package where the project files will be stored. All the modules you download will be stored in the package.

npm init 

The npm init command will also create the package.json file, and prompt you to add the following project information when creating a project:

  • Project name

  • Project initial version

  • Project description

  • The project’s entry point

  • The project’s entry point

  • The project’s test command

  • The project’s git repository

  • The project’s license

The information will be stored in the package.json file. The package.json file contains the important details and metadata of your project such as package versions.

Here is an example of a package.json file:

{

  "name": "hometech",

  "version": "1.0.0",

  "description": "How to install node package manager",

  "main": "index.js",

  "scripts": {

    "test": "echo \"Error: no test specified\" && exit 1",

    "start": "node server.js"

  },

  "author": "Boemo Mmopelwa",

  "license": "MIT",

  "dependencies": {

    "@apollo/client": "^3.3.7",

    "Express": "^3.0.1",

    "apollo-angular": "^2.2.0",

    "express": "^4.17.1",

    "express-graphql": "^0.12.0",

    "graphql": "^15.4.0"

  },

  "devDependencies": {},

  "keywords": [

    "vultr"

  ]

}

The package.json file is stored in your current prescribed directory but you can also move it to your desired destination.

If you want to skip the questions asked when creating a project, use this command:

npm init  --yes 

The above command will initialize the project and skip all the required details required by the package.json file. You can set these configuration details later when you’re ready to add them. But these are important details that should never be forgotten to be added.

You can use the following commands to install additional information:

  • npx license: use this command to download your preferred license package such as MIT.

  • npx gitignore: This command downloads the gitignore file from GitHub’s repo of your choice using the gitignore package.

  • npx covgen: This command uses the covgen package to generate the Contributor Covenant. This command will also generate a code of conduct that all contributors must abide by.

Setting config options for the init command

The node package manager allows you to set default config options for the npm init command.

Here are some of the commands you can use to set default config options:

Setting the author’s email address

The following command sets your default email address.

> npm set init.author.email "enter your email address here"

Setting the author’s name

The following command sets your default author name.

> npm set init.author.name "enter your author name here"

Setting the project license

The following command sets your project’s license.

> npm set init.license "MIT"

How to add dependencies in the package.json file manually

Use the dependencies attribute to manually add dependencies to the package.json file by referencing the name and version of the dependency using any text editor such as Microsoft Visual studio:

{

 "name": "hometech",

 "version": "1.0.0",

 "dependencies": {

 "my_dep": "^1.0.0",

 }

}

Use the devDependencies attribute to manually add devDependencies name and version to the package.json file:

"name": "hometech",

"version": "1.0.0",

"dependencies": {

"my_dep": "^1.0.0",

},

"devDependencies" : {

"my_test_framework": "^3.1.0".

"another_dev_dep": "1.0.0 - 1.2.0"

}

How to list packages in dependencies

You can check and keep track of all installed using the npm list command. The npm list command will generate a list of all installed packages.

npm list

The command will output all installed packages:

demo@1.0.0 C:\Users\Demo

+-- @apollo/client@3.3.7

+-- apollo-angular@2.2.0

+-- array-flatten@1.1.1 extraneous

+-- body-parser@1.19.0 extraneous

+-- content-disposition@0.5.3 extraneous

+-- cookie-signature@1.0.6 extraneous

+-- cookie@0.4.0 extraneous

+-- debug@2.6.9 extraneous

+-- destroy@1.0.4 extraneous

+-- ee-first@1.1.1 extraneous

+-- encodeurl@1.0.2 extraneous

+-- escape-html@1.0.3 extraneous

+-- etag@1.8.1 extraneous

+-- express-graphql@0.12.0

+-- Express@3.0.1 invalid: "^4.17.1" from the root project

+-- finalhandler@1.1.2 extraneous

+-- forwarded@0.1.2 extraneous

+-- fresh@0.5.2 extraneous

+-- graphql@15.4.0

+-- http-errors@1.7.2 extraneous

+-- type-is@1.6.18 extraneous

+-- utils-merge@1.0.1 extraneous

How to Install Modules using npm

The npm install command is used to install modules such as Express. To use this command just add the name of your module after the install keyword.

npm install <enter the module name here>

If you don’t want to install a specific module you can go ahead and install modules and project dependencies listed in the package.json file using the following command.

npm install

If you are installing a module that hasn’t been listed in the package.json file. You can use the following command to install and add the module to the package.json file as a project dependency.

npm install <module> --save 

You can also use the --save-dev flag which adds the module as a devDependencies. Development dependencies (devDependencies) are used for development purposes only, they are not required during runtime.

npm install <module> --save-dev 

How to Install Modules Globally on your System

If you want all of your applications to use a specified module, install the module globally by using the--global flag so that all Node.js applications in your system can access the module:

npm install <enter the module you want to install globally here> --global 

Inspecting and auditing installed packages

Security vulnerabilities found in packages often cause service outages and data loss. Inspecting and auditing your Node.js package dependencies using the npm audit command could help you identify security vulnerabilities and fix them before they cause data loss.

The npm audit command is only supported in npm version 6.0.0 and later versions only.

The npm audit command sends details about the package’s dependencies and devDependencies for inspection to your default registry. A report will be sent back which contains results of your package dependencies, devDependencies, bundledDependencies, and optionalDependencies security state.

Follow the following steps to audit your package dependencies:

  1. Launch the command line and navigate to your package directory.

  2. Make sure that your package includes the package.json and package-lock.json files.

  3. Insert the npm audit command and press enter to start the security auditing process.

  4. After the report has been generated using the previous command you can now analyze the audit report and implement security measures to eliminate security vulnerabilities detected in your package dependencies.

Node Package Manager Command Cheat Sheet

Here is a list of essential commands that you will use after you install Node.js and the node package manager.

  • npm uninstall <package>: This command is used to uninstall a package.

  • npm list -g —depth=0: List globally installed packages.

  • npm -g uninstall <name>: This command is used to uninstall a global package.

  • npm-windows-upgrade: Upgrade npm on Windows.

  • npm run: list available scripts to run.

  • npm-windows-upgrade: This command is used to update npm.

Copyright OpenJS Foundation and Node.js contributors. All rights reserved. The OpenJS Foundation has registered trademarks and uses trademarks. For a list of trademarks of the OpenJS Foundation, please see our Trademark Policy and Trademark List. Trademarks and logos not indicated on the list of OpenJS Foundation trademarks are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

The OpenJS Foundation | Terms of Use | Privacy Policy | Bylaws | Code of Conduct | Trademark Policy | Trademark List | Cookie Policy

Introduction

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 to render content before it is delivered to a web browser.

NPM stands for Node Package Manager, which is an application and repository for developing and sharing JavaScript code.

This guide will help you install and update Node.js and NPM on a Windows system and other useful Node.js commands.

Tutorial on how to install, use, update and remove Node.JS and NPM (Node package manager)

Prerequisites

  • A user account with administrator privileges (or the ability to download and install software)
  • Access to the Windows command line (search > cmd > right-click > run as administrator) OR Windows PowerShell (Search > Powershell > right-click > run as administrator)

Step 1: Download Node.js Installer

In a web browser, navigate to https://nodejs.org/en/download/. Click the Windows Installer button to download the latest default version. At the time this article was written, version 10.16.0-x64 was the latest version. The Node.js installer includes the NPM package manager.

Location of download link of NodeJS installer.

Note: There are other versions available. If you have an older system, you may need the 32-bit version. You can also use the top link to switch from the stable LTS version to the current version. If you are new to Node.js or don’t need a specific version, choose LTS.

Step 2: Install Node.js and NPM from Browser

1. Once the installer finishes downloading, launch it. Open the downloads link in your browser and click the file. Or, browse to the location where you have saved the file and double-click it to launch.

2. The system will ask if you want to run the software – click Run.

3. You will be welcomed to the Node.js Setup Wizard – click Next.

4. On the next screen, review the license agreement. Click Next if you agree to the terms and install the software.

5. The installer will prompt you for the installation location. Leave the default location, unless you have a specific need to install it somewhere else – then click Next.

6. The wizard will let you select components to include or remove from the installation. Again, unless you have a specific need, accept the defaults by clicking Next.

7. Finally, click the Install button to run the installer. When it finishes, click Finish.

Step 3: Verify Installation

Open a command prompt (or PowerShell), and enter the following:

node -v

The system should display the Node.js version installed on your system. You can do the same for NPM:

npm -v
Testing Node JS and NPM on Windows using CMD

If npm is not recognized or properly installed, command prompt will display the following error message: npm: command not found.

How to Update Node.js and NPM on Windows

The easiest way to update Node.js and NPM is to download the latest version of the software. On the Node.js download page, right below the Windows Installer link, it will display the latest version. You can compare this to the version you have installed.

To upgrade, download the installer and run it. The setup wizard will overwrite the old version, and replace it with the new version.

How to Uninstall Node.js and NPM on Windows

You can uninstall Node.js from the Control Panel in Windows.

To do so:

  1. Click the Start button > Settings (gear icon) >  Apps.
  2. Scroll down to find Node.js and click to highlight.
  3. Select Uninstall. This launches a wizard to uninstall the software.

Basic Node.js Usage

Node.js is a framework, which means that it doesn’t work as a normal application. Instead, it interprets commands that you write. To test your new Node.js installation, create a Hello World script.

1. Start by launching a text editor of your choice.

2. Next, copy and paste the following into the text editor you’ve just opened:

var http = require('http');
 http.createServer(function (req, res) {
   res.writeHead(200, {'Content-Type': 'text/html'});
   res.end('Hello World!');
 }).listen(8080);

3. Save the file, then exit. Open the PowerShell, and enter the following:

node \users\<your_username>\myprogram.js

It will look like nothing has happened. In reality, your script is running in the background. You may see a Windows Defender notice about allowing traffic – for now, click Allow.

4. Next, open a web browser, and enter the following into the address bar:

http://localhost:8080

In the very upper-left corner, you should see the text Hello World!

Right now, your computer is acting like a server. Any other computer that tries to access your system on port 8080 will see the Hello World notice.

To turn off the program, switch back to PowerShell and press Ctrl+C. The system will switch back to a command prompt. You can close this window whenever you are ready.

Conclusion

You should now be able to install both the Node.js framework, and the NPM package manager. You’ve also written your first node.js JavaScript program!

The NPM framework gives access to many different JavaScript solutions, which can be found at npmjs.com.

Quick Summary:

The node.js environment needs to be installed on your desktop or laptop before you can begin developing your Node.js applications, whether you’re a developer or a student. Using Node.js with NPM is important for your next project. This blog will help you in installing Nodejs and NPM on your system using two different methods.

JavaScript programmers worldwide who struggle to elevate their code into a robust development environment now have Node.js to thank for their relief. You can now create two-way web applications using Node.js, allowing the server and client sides to interact fully and exchange data in real-time.

Using custom modules, Node.js can incorporate extra or enhanced functionality. You must install these modules individually. NPM and node.js installation on Windows is made simple by this blog. Nevertheless, let’s first look at what Node.js and NPM are before we get into the step-by-step installation.

What are Node.js and NPM?

You can build web servers and networked applications using Node.js, a JavaScript-based environment. Moreover, it may be used to concatenate, minify, and compile SaaS files into CSS, among other beneficial computer activities.

What are Node.js and NPM?

A “package Manager” called NPM makes installing node “packages” quick and simple. Simply put, a package is a code library that enhances Node by including valuable features. Well-known businesses, including Netflix, PayPal, NASA, and Walmart, utilize Node.js. It has several benefits that, in some situations, make it a far better option than that other server-side platforms like PHP or Java.

Nodejs is the most popular web development technology, according to the Stack Overflow Developer Survey 2022. Nodejs manages numerous concurrent clients simultaneously using a “single-threaded event loop” design. The JavaScript event-based architecture and call-back mechanism are the foundation for the node.js processing model.

Prerequisites of installing Nodejs and NPM

Before we start, here are a few system requirements to download, install, and set up.

Prerequisites of installing Nodejs and NPM

Requirements  

  • 4GB RAM
  • CPU Intel core i3TM i3 HQ CPU @2.50 GHz
  • ROM 256GB
  • A user account with admin privileges
  • Access to the windows command line

Now that we have covered the prerequisite let’s understand which version of Node.js you want to go for.

LTS Version vs. Current Version: Which One to go With?

There are two different versions of Node.js that you can work with: the LTS Version and the Current Version.

Let’s begin with the LTS!

The first is Long-Term Support (LTS), a version available for a while and with all necessary support. As a result, a tonne of resources and a community are available for help with this edition.

This LTS version is frequently suggested to users due to its sustainability and 18-month support cycle. Because it is a stable version and will help you obtain a reliable outcome, you can develop backends using it.

Let’s move forward to the current version.

The most recent Node version available is listed in the Current version field, along with any new or changed features. But this version might have flaws, and only roughly eight months of support are needed. Experts advise just using this version for front-end development as a result.

If you’re a frequent user who appreciates a hassle-free lifestyle, consider all these factors and select the LTS version. Installing the most recent version is an option if you’re an experienced user who appreciates the challenge of exploring cutting-edge technology.

In search to Hire Node JS Developers?

Hire dedicated Full-Stack Node.JS developers Team from Aglowid to build high-performance & scalable web & mobile app solution.

Each operating system has different methods through which you can install Node.js. The core setup differs for each OS; however, you can find these different file types on the official website. In the next section of this article, we will look at the step-by-step guide for installing NPM and Node.js on Windows.

How to install NPM and Node.js in Windows?

Traditional Method

Since you have decided to create an application using Node.js first, you must install Node.js on your system. Here we are going to explain the installation process using a step-by-step guide. So, let’s begin with the first step.

Step 1: Download the installer

First, you need to download the windows installer (.msi) file or opt for Windows binary (.zip) from the official node.js website. While writing this blog, the latest LTS version of Node.js is 18.14.2.

Download the installer

Note: If you have older systems, don’t worry, this setup is available in various formats, including a 32-bit version. To select the current version, you can navigate to the right side of the screen to the “current latest features.” It is important to note that if you’re new to node.js or don’t have a specific version requirement, you can go for the LTS version.

Step 2: Install Node.js and NPM from Browser

Once the installer is downloaded, launch it and follow the instructions. You need to press “next” for few times, select the path you want node.js to install, and finish the setup process. Restart your computer once you’ve installed node.js.

Step 3: Test & verify the installation

Ensure you have the downloaded node.js working properly using the simple commands mentioned below. You can use a command prompt or PowerShell to run these commands.

Test Node.js and NPM Version

Type the command’ node -v’ and ‘npm -v’ to check the version of node.js and NPM you have installed. Run these commands, and you’ll get some numbers on the screen, such as 8.8.0, which shows the version of the software installed.

Test Node.js and NPM version

Here you can see that the version of the Node installed is v18.14.2, and npm is 8.8.0. Now let’s create a file with simple code and test it.

Create the simple Javascript file,  name it hello.js, and add the code console. log('Node is installed!');. To run this code, open your command prompt, browse to the location where you saved the file, and type node hello.js. This will start the Node and will run the code in the program. You will see the output of ‘Node is installed!’.

command prompt

Also Read: Node js vs React: Checkout the Difference

NPM Method

Node.js and NPM can be downloaded and installed on Windows in various ways. You can set up NPM and node.js on your computer using the software package manager Chocolatey. Let’s look at the step-by-step process for installing NPM and node.js on Windows using Chocolatey. In addition, we’ll look at how to remove Chocolatey from the same.

Before diving into the installation of chocolatey, let’s first understand what it is chocolately.

Chocolately was developed to offer the universal package manager for windows. Created by Rob Reynolds in 2011, it is an open-source project that helps developers and admins manage windows software. In Summary, it is a decentralized framework for quickly installing your needed applications and tools.

Now that you have an overview of chocolately, let’s see the step-by-step installation guide.

Requirements

  • Windows 7+ / Windows Server 2003+
  • PowerShell v2+ (minimum is v3 for installation from this website due to TLS 1.2 requirement)
  • .NET Framework 4+ (the installation will attempt to install .NET 4.0 if you do not have it installed)(minimum is 4.5 for installation from this website due to TLS 1.2 requirement)

Install Chocolately

Unlike the traditional method, you can choose which version of chocolately you want to download. There are six types of downloads available. The following are the versions available.

  • Generic
  • Individual
  • Ansible
  • CHEF
  • PSDSC
  • Puppet

Note:Please look at here before running any of the scripts mentioned here. We know it’s safe, but you must verify the security and contents of any script from the internet. You must take security seriously, as all these scripts download and execute the PowerShell script.

The first step is to ensure you are using an administrative shell. Apart from that, you can also install a non-admin version.

The second step is that you must confirm that Get-ExecutionPolicy is not restricted. We suggest using Bypass to bypass the policy to get things installed or AllSigned for quite a bit more security.

Run Get-ExecutionPolicy. If it returns Restricted, run Set-ExecutionPolicy AllSigned or Set-ExecutionPolicy Bypass -Scope Process.

Run Get-ExecutionPolicy

Now run the following command:

Set-ExecutionPolicy Bypass -Scope Process -Force;
[System.Net.ServicePointManager]::SecurityProtocol =
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object
System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

This command will help you bypass the execution policy set in place.  When done correctly, you’ll get the screens as below. 

Now run the following command

Lastly, paste your copied text into the shell and press enter. Wait a few minutes, and if you don’t see any error pop-ups, congratulations! You have successfully installed chocolately.

You can check the installation by checking the version of chocolately using the following commands:

Choco -v

Choco -v

This brings us to the end of the installation of node.js using chocolately.

Why should we use NodeJS?

Before the inception of Node.js, developers were working on the stateless request-response pattern, but after Node.js, developers can use web applications with real-time connections, where both the included parties can initiate the communication.

Why should we use NodeJS

This might not look like a big thing, but it starkly contrasts the web response paradigm where the client had to initiate the communication. Apart from this, node.js provides various advantages, which makes it the better choice. Some of the advantages that node.js provide are Speed, Ubiquity, DataQuries, Real-time applications, Single-codebase, and Increased Productivity. Now that it is clear why we should use node.js let’s look at the use cases in which you can use Node.js and NPM together.

When to use Node.js and NPM?

Node.js is a well-liked runtime environment for creating server-side applications, and NPM (Node Package Manager) is a potent package manager that enables programmers to manage and share reusable code modules quickly.

When to use Node.js and NPM?

There are various use cases where you can use Node.js and NPM. Here we have curated the list of use cases where both are used.

  • Developing Micro APIs.
  • Hosting SPAs. (Single-page applications)
  • Developing Streaming Web applications
  • Building Real-Time Chatbots
  • Creating collaboration tools
  • Creating Big-data & Analytics solutions
  • Crafting Microservices Architectures
  • Creating a Real-Time Tracking Dashboard

When NOT to use Node.js and NPM?

Like a story has two sides, in technology, there are pros and cons of every tech stack, and node.js is no different. While there are many criteria where Node.js shines, there are few where it may not be the best choice for your project. Following are some of the scenarios:

When NOT to use Node.js and NPM?

  • Where heavy server-side computing is required
  • Server-side application working with relational database
  • Applications with CRUD

have a unique app Idea?

Hire Certified Developers To Build Robust Feature, Rich App And Websites.

Wrapping Up!

In conclusion, installing Node.js with NPM is a rather easy and simple process. The right procedures can be followed to swiftly set up an environment and use Node.js to create strong, effective apps. Node.js is a preferred option for developers because of its advantages, including speed and scalability. Moreover, NPM offers access to a sizable selection of libraries and packages that help to speed up the development process. Node.js with NPM is a great framework for creating quick and scalable online apps, regardless of your level of experience as a developer.

Node.js came as a blessing for JavaScript developers worldwide struggling with swapping among multiple languages and frameworks to amplify their code into a sustainable development environment.

With Node.js, you can finally build web applications with two-way connections where both the server-side and client-side can thoroughly communicate in real-time and exchange data. Indeed, Node.js has been revolutionary for developers who wanted to push real-time web applications over WebSocket.

If you’re aiming forward to enhancing your web development skills to the next level and becoming a full-stack JavaScript developer, Node.js indeed prepares the path towards that enthusiastic buzzword!

In this article, we’ll demonstrate a step-by-step guideline for installing Node.js on your computer and commencing with your web development journey.

What Is Node.js?

Nodejs official logo.

Node.js logo. (Image source: Node.js)

The first thing you should know is that Node.js is not a programming language!

You may already be aware of this fact, but it bears repeating for new developers in the field who may mistake Node.js for a unique programming language. It’s not!

Node.js is an open-source runtime environment for the JavaScript language that reshapes JavaScript’s characteristics and upgrades its functionality. As a result, you can use JavaScript for frontend and backend development, enabling full-stack development solely using JavaScript.

Initially, Node.js was designed to serve real-time performance, pushed-back architectures. But since then, Node.js has grown into a vital element for server-side programming for event-driven, non-blocking servers. Most conventional websites and API services today depend on Node.js.

Before Node.js, if you wanted to store any data on the database or connect your program to the database, you needed support from a server-side language. That’s because JavaScript couldn’t regulate the backend process. Consequently, you had to learn server-side languages like PHP, Python, Ruby, or C# — or seek a backend developer’s help.

The Node.js environment empowers JavaScript to directly employ the database and function properly as a backend language. As a result, you can ultimately build and run a program using only JavaScript with Node.js.

Node.js uses the V8 JavaScript runtime engine as its root power, and it employs a non-blocking I/O architecture that’s event-driven. All these together construct Node.js and help drive products towards robust performance.

Who Uses Node.js?

According to W3Techs, to date, 1.4% of all websites use Node.js — that’s more than 22 million websites. These numbers give you a general idea of the amount of Node.js users. On top of that, Node.js has been downloaded more than 1.3 billion times! As you can see, the stats speak strongly to Node.js’ market scale.

From your friends in IT to the industry tycoons, all are enjoying leveraging Node.js. That’s because Node.js amplifies the performance of developers and increases the speed of the development process. One of the most intelligent trends nowadays is using JavaScript everywhere, which has brought Node.js into the arena.

Top companies that use Node.js include:

  1. NASA
  2. Twitter
  3. Netflix
  4. LinkedIn
  5. PayPal
  6. Trello
  7. eBay
  8. Walmart
  9. Mozilla
  10. Medium

If you study these companies, you may notice that they run their businesses on different services or products. But they all have a critical factor in common: they rely on Node.js. Indeed, using Node.js can solve most of your development issues, never mind what industry you’re in.

Advantages of Using Node.js

Choosing the right programming platform for your tech stack is as important as the labor you want to invest in. Multiple factors should be considered when you look for the advantages of using a particular platform. Things like the learning curve, development speed, community, and scale can alter the overall balance of benefits.

Here are the main advantages of using Node.js:

  • Simple syntax
  • Easy learning curve
  • Ability to scale quickly
  • Open source and flexible
  • Cross-platform development
  • Single-language full-stack development
  • Real-time communication
  • Vast and active community

Node.js Prerequisites

Before installing Node.js, you need to ensure that you’ve gathered all the necessary bits of knowledge and downloaded all required installation files and elements.

Firstly, it would help if you had a basic understanding of JavaScript and its syntax — this will make picking up Node.js easier for you.

Secondly, a basic understanding of an object-oriented programming (OOP) language will help you work on server-side coding.

Lastly, rather than rushing into deep learning, take it one step at a time. Always remember that you’re not a day late or a dollar short as long as you’re progressing.

System Requirements

Node.js doesn’t require a fancy hardware setup to run; most computers of this era should handle Node.js efficiently. Even the most miniature computers like BeagleBone or Arduino YÚN can run Node.js.

Nevertheless, much still depends on what other memory hog software you’ve got running on the same system. But in most cases, you shouldn’t be worried unless your computer is from the Mesozoic Era!

LTS Version vs Current Version

Node.js offers two different versions for you to download: the LTS version and the Current version.

The first one is Long-Term Support (LTS), which indicates the version that has been in the market for a while and comes with all mandatory support. Consequently, you can access a bunch of information and community for additional help with this version.

This LTS version is recommended to most users because of its sustainability and 18-month-long support cycle. As it’s a stable version, using it to produce backends can help you achieve a robust outcome.

The Current version indicates the latest released version of Node with the most recently added and updated features. But this version has less support behind it (around eight months) and possible bug exposure. Therefore, experts suggest using this version only for frontend development.

Considering all these factors, if you’re a regular user who loves to live hassle-free, go for the LTS version. On the other hand, if you’re an advanced user who loves the adventure of experiencing new technology, you can choose to install the Current version.

How to Install Node.js and npm

Every operating system has a distinct method of installing Node.js. The core setup file differs for each OS to OS. However, the Node.js creators have taken care to provide you with the files needed for each system.

In the next portion of the article, we’ll discuss installing Node.js on Windows, macOS, and Linux operating systems.

How to Install Node.js on Windows?

Follow this step-by-step guide to install Node.js on Windows.

1. Download Windows Installer

First, you need to download the Windows Installer (.msi) file from the official Node.js website. This MSI installer database carries a collection of installer files essential to install, update, or modify the existing Node.js version.

Notably, the installer also carries the Node.js package manager (npm) within it. It means you don’t need to install the npm separately.

When downloading, select the correct version as per your operating system. For example, if you’re using a 64-bit operating system, download the 64-bit version, and if you’re using the 32-bit version, download the 32-bit version:

Downloading the Node.js installer.

Downloading the Node.js installer.

2. Begin the Installation Process

Once you open and run the .msi file, the installation process begins. But you have to set a few parameters before running the installation process.

Double-click on the installer file and run it. The installer will ask you to accept the Node.js license agreement. To move forward, check the “I accept” box and click Next:

Accepting the Node.js license agreement.

Accepting the Node.js license agreement.

Then, select the destination where you want to install Node.js. If you don’t want to change the directory, go with the Windows default location and click the Next button again.

Selecting the appropriate Node.js installation folder.

Selecting the Node.js installation folder.

The next screen will show you custom setup options. If you want a standard installation with the Node.js default features, click the Next button. Otherwise, you can select your specific elements from the icons in the tree before clicking Next:

Using the Node.js installer's

“Custom Setup” options in the Node.js installer.

Node.js offers you options to install tools for native modules. If you’re interested in these, click the checkbox to mark your preferences, or click Next to move forward with the default:

Installing tools for native modules in None.js.

Tools for native modules in the Node.js installer.

3. Run Node.js Installation on Windows

Lastly — and this is the easiest part of all — click the Install button to begin the installation process:

Beginning the Node.js installation.

Beginning the Node.js installation.

The system will complete the installation within a few seconds or minutes and show you a success message. Click on the Finish button to close the Node.js installer.

Finishing the Node.js installation on Windows.

Finishing the Node.js installation on Windows.

4. Verify Node.js Installation

So the installation process is completed. Now, you have to check whether Node.js is successfully installed or not.

To verify the installation and confirm whether the correct version was installed, open your PC’s command prompt and enter the following command:

Node --version

And to check the npm version, run this command:

npm --version

Performing a Node.js npm version check on Windows.

Verifying Node.js installation on Windows.

If the Node.js version and npm are correctly installed, you’ll see the version name in the CMD prompt.

How To Install Node.js on macOS?

Follow these step-by-step guidelines to install Node.js on macOS.

1. Download macOS Installer

Installing Node.js on macOS follows almost the same procedure as Windows. All you have to do is to download the installation file for Mac. Then, as soon as you start it up, the installer will walk you through the rest.

Firstly, download the macOS installer (.pkg) file from the Node.js website. There’s only a 64-bit version, so you don’t have to worry about which to download.

Downloading the Node.js macOS installer.

Downloading the Node.js macOS installer.

2. Begin Node.js Installation on macOS

Check your Download folder for the installer file and click on it to start the installation process.

The Node.js installer carries the Node.js core file, and, consequently, the installation process installs both Node.js and npm from the installer file. Therefore, you don’t need to install npm separately.

Then, click Continue to move forward with the installation.

Checking the Node.js macOS installation properties.

Node.js macOS installation properties.

You must agree to the terms of usage to install Node.js. Read through it before clicking the Agree button to continue if you’d like to explore the license agreement.

Accepting the Node.js license agreement on macOS.

Node.js macOS installation license agreement.

At this screen, you need to select the installation location. Usually, the OS determines a default installation location. If you have other requirements, you can change the location. Otherwise, keep the default location.

3. Run Node.js Installation on macOS

Until now, you’ve set all the preferences that are needed to install Node.js on macOS fully. Now click on the Install button to finish things up.

Selecting the Node.js installation location on macOS.

Selecting the Node.js installation location on macOS.

After a successful installation process, the system will show you a confirmation message. As npm is integrated within the Node.js installer, the notification should indicate proof of npm installation too.

Finally, click on the Close button to close the dialogue box.

Closing the Node.js installer on macOS.

Closing the Node.js installer.

4. Verify Node.js Installation on macOS

You’ve now successfully installed Node.js on your macOS. However, you should check to confirm that the installation process was successful and whether the Node.js and npm versions are working properly on your macOS.

To check the Node.js version, you need to open your macOS terminal, click the Command + Space keys, or search the terminal from the search bar.

Opening the macOs terminal.

Opening the macOS terminal.

To check the Node.js version, type:

Node --version

And to check the npm version, run this command:

npm --version

Verifying Node.js installation on macOS.

Verifying Node.js installation on macOS.

If the Node.js and npm versions are visible, both of them are correctly installed and working fine. If not, you may need to recheck to find the error or try the installation process again.

How To Install Node.js on Linux?

The Linux operating system works a bit differently than the other traditional operating systems. That’s because Linux is open-source, offering you more freedom, customization, and advanced functionalities.

If you’re casual with commands, you should feel comfortable with Linux. Here, we are about to discuss the easiest method of installing Node.js on the Linux operating system.

1. Choose the Node.js Version for Your Linux Distribution

The Linux operating system has hundreds of different distributions because of the diversity it provides. And users love to customize and harness different versions’ specific functionalities using distinct distributions.

Firstly, find the installation instruction for your specific distribution from Node.js’s Binary Distributions page. For this guide, we’ll be using Ubuntu for illustration purposes.

Node.js Ubuntu installation instructions.

Node.js Ubuntu installation instructions.

2. Install the Curl Command-Line Tool

Before going for Node.js installation, ensure that you have the curl command-line utility installed on your system. If not, then paste this command on your terminal to install curl:

sudo apt install curl

It may ask for your system password to verify the permission of the installation. Once you input the password, the system should begin the curl installation.

Install "curl" on Ubuntu.

Installing “curl” on Ubuntu.

3. Start Node.js Installation

You need to copy and paste the Node.js installation command into your terminal (in our case, we can grab it from the Ubuntu distribution page) so that the system can begin the Node.js installation.

For instance, here, we’ll be installing Node.js v14.x. These are the installation commands for Ubuntu:

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

As you already have the curl command line installed on your terminal, you’ll need to copy and paste the first command (the curl command) on your terminal and run it.

Beginning the Node.js installation on Ubuntu.

Beginning Node.js installation on Ubuntu.

The curl command begins the Node.js installation process, updates your system, and downloads all Node.js libraries required to install Node.js on your Linux OS.

Node.js library installation.

Node.js library installation.

Now, all the libraries and resources of Node.js have been downloaded to your PC. With one final command, we can finish installing Node.js and npm on your computer.

Copy and paste the second line of command from the installation instructions above into your Linux terminal:

sudo apt-get install -y nodejs

Node.js Ubuntu installation.

Installing Node.js on Ubuntu.

If you’ve done everything correctly, Node.js will install correctly on your Linux distribution. Now input the Clear command to clear the terminal.

4. Verify Node.js Installation on Linux Ubuntu distribution

As you’ve installed Node.js, you can verify to check whether the installation is successful or not. To confirm the installation, you need to run two simple Linux commands on your Linux terminal.

To check the Node.js version, type:

Node --version

And to check the npm version, type:

npm --version

Verifying Node.js installation on Ubuntu.

Verifying Node.js installation on Ubuntu.

If the Node.js version and npm are installed correctly, you’ll see the Node.js and npm version names visible on the Linux terminal. It indicates that you have successfully installed Node.js and npm on your Linux distribution.

Check and Update npm Version

As we’ve mentioned, npm is the Node.js package manager. It manages the dependencies for packages. Without npm, you would have to unpack all your Node.js packages manually every time you want to upload a framework. But npm relieves you of this responsibility and takes care of it automatically.

Regularly updating npm also updates your local packages and improves the code used in your projects. However, as npm automatically installs with the Node.js version you choose, it often misses the latest npm release. In such cases, you can check your npm version and update it manually in a simple process.

The processes to check and update your npm version are very similar between Windows, macOS, and Linux — you’ll be running the same command on each.

Update npm in Windows

To check the npm version, run the following command:

npm -v

…or:

npm --version

And to update the npm version, run this command:

npm install -g npm@latest

After running this command on your CMD prompt on Windows, the system will update your npm version and install the additional packages in a few seconds. In the end, you can recheck the version to confirm the update of the npm version.

Updating npm version on Windows.

Updating npm on Windows.

Update npm on macOS

To check the npm version on macOS, open your terminal and run the following command:

npm -v

…or:

npm --version

Checking npm version on macOS.

Checking npm version on macOS.

To update the npm version, run this command in your macOS terminal:

npm install -g npm@latest

update npm on macOS.

Updating npm on macOS.

Update npm in Linux

To update your npm version on Linux, type these commands into your terminal:

sudo npm install -g n

…and then:

sudo n latest

Updating npm version on ubuntu.

Updating npm on Ubuntu.

With Node.js, you can take your web dev skills to the next level 📈… so what are you waiting for? Get started with this guide 👇Click to Tweet

Summary

Node.js has become a popular programming environment quickly because of its usefulness in both frontend and backend. Thousands of active users have created a vast community that helps keep new developers and their questions from slipping through the cracks.

In essence, it’s easy to start with Node.js because of its simplicity, and its capabilities for creating advanced applications are extraordinary. It can also help turn you into a full-stack developer in a short time. These features make Node.js an inevitable choice for next-generation programming.

Have we missed any helpful tips about installing Node.js on Windows, macOS, or Linux? Let us know in the comments section!

Zadhid Powell

Zadhid Powell is a Computer Engineer who gave up coding to start writing! Alongside, he is a Digital Marketer, technology enthusiast, SaaS expert, reader, and keen follower of software trends. Often you may find him rocking downtown clubs with his guitar or inspecting ocean floor diving.

  • LinkedIn

  • Twitter

  • Npm command not found windows
  • Nt kernel system синий экран windows 10
  • Nt kernel and system что это windows 7
  • Ntfs или exfat для ssd windows 10
  • Nt 5890k driver windows 10