How to Install node.js and NPM on Windows?

How to Install node.js and NPM on Windows? Node.js is a run-time environment that comes with everything you need to run a JavaScript program. Before content is sent to a web browser, it is used to run programs on the server to render it.

Node Package Manager, or NPM, is a tool and repository for creating and exchanging JavaScript code.

This post will assist you in setting up Node.js, NPM, and other helpful Node.js commands on a Windows computer.

  1. A user profile with administrative rights (or the ability to download and install software)
  2. Either Windows PowerShell (Search > PowerShell > right-click > run as administrator) OR the ability to use the Windows command line (Search > cmd > right-click > run as administrator)

How to Install node.js and NPM on Windows Step by Step?

Step 1: Get the Node.js installer.

Go to https://nodejs.org/en/download/ via a web browser. To get the most recent default version, use the Windows Installer option. Version 10.16.0-x64 was the most current version at the time this article was written. The NPM package manager is included in the Node.js installer.

Step 2: Download and install NPM and Node.js

  1. Open the installer after it has finished downloading. Click the file after opening the downloads link in your browser. Alternatively, you can double-click the file by navigating to where you stored it to start it.
  2. Click Run when the system prompts you to run the program.
  3. After being welcomed, click Next to see the Node.js Setup Wizard.
  4. Examine the license agreement on the next screen. If you are ready to install the software and accept the terms, click Next.
  5. The installer will ask you where you want to install it. Click Next after selecting the default location unless you have a reason to install it elsewhere.
  6. You can choose which components to include or leave out of the installation using the wizard. Again, click Next to accept the settings unless you have a compelling need to change them.
  7. To launch the installer, click the Install option. Click Finish when it’s finished.

Step 3: Verify Installation

Launch PowerShell or a command prompt and type the following:

  • node -v

The Node.js version that is currently installed on your machine ought to be visible. The same applies to NPM:

  • npm –v

How to Update node.js and NPM on Windows?

Windows

Node.js can be removed from Windows’ Control Panel.

To do this:

  1. Select "Start" > "Settings" (the gear icon), then "Apps."
  2. Click to highlight Node.js after scrolling down to find it.
  3. Choose Uninstall. This starts the program uninstall wizard.

Simple Node.js Use

Node.js is a framework, thus it doesn’t function like a typical application. Instead, it translates the instructions you type. Make a Hello World script to test your new Node.js installation.

1: Start by opening your preferred text editor:

2: After that, paste the subsequent content into the text editor you just launched:

var http = require('http');

 http. create Server (function (req, res) {

   res. write Head (200, {'Content-Type': 'text/html'});

   res. end ('Hello World!');

 }). listen (8080);

3: After saving the file, go away. Launch PowerShell and type the following commands:

  • Users your username> node
  • js

It will appear that nothing has changed. Your script is actually executing in the background. If Windows Defender displays a warning about permitting traffic, click Allow for the time being.

4: After that, launch a browser and type the following into the address bar:

  • http://localhost:8080

You should see the words “Hello World” in the upper-left corner.

Your computer is currently working as a server. The Hello World message will appear on any other computer that tries to access your system via port 8080.

Switch back to PowerShell and hit Ctrl+C to end the program. The command prompt will appear once more on the computer. This window may be closed anytime you are prepared.

Conclusion

How to Install node.js and NPM on Windows? Both the Node.js framework and the NPM package management should now be installable. Additionally, you’ve created your first JavaScript node.js program!

Category:

Share:

90%OFF

Flash Sale

Hurry Up! Offer ends in
02 days
06 hrs
30 mins
31 secs
Buy Now