Full stack developer skills LEARNOVITA

How to Install NPM in Windows [ OverView ]

Last updated on 06th Jan 2023, Artciles, Blog

About author

Jesica Parveen (Full Stack Developer )

Jesica Parveen has 8+ years of full-stack developer expertise in HTML, CSS, JavaScript, jQuery, CSS, SEO, and back. She has skills in Servlet and JSP development; CSS, JavaScript, HTML, AJAX, jQuery, EXTJS, OSGi/FELIX, CMS development experience, Java Content Repository (JCR), and Eclipse IDE.

(5.0) | 17854 Ratings 2271
    • In this article you will learn:
    • 1.Prerequisites
    • 2.How to Install a Node.js and NPM on Windows
    • 3.How to Update a Node.js and NPM on Windows
    • 4.How to Uninstall a Node.js and NPM on Windows
    • 5.Writing a first program on node.js
    • 6.Conclusion

1.Prerequisites

  • A user account with an administrator privileges (or ability to download and install software)
  • Access to a Windows command line (search > cmd > right-click > run as a administrator) OR Windows a PowerShell (Search > Powershell > right-click > run as a administrator)
  • Hardware requirements
  • RAM 4GB
  • A CPU Intel Core i3TM i3 HQ CPU @2.50 GHz
  • ROM 256 GB
  • Software requirement
  • Chocolatey

Attention: will also need a stable internet connection because will be downloading most of this software.

How to Install a Node.js and NPM on Windows

Step 1:

  • Download a Node.js Installer
  • Click a Windows Installer button to download latest default version.
  • At a time this article was written, version 10.16.0-x64 was the latest version.
  • The Node.js installer includes a NPM package manager.

Step 2:

Install a Node.js and NPM from Browser

NPM Installation
  • 1. Once installer finishes downloading, launch it. Open a downloads link in a browser and click the file. Or, browse to a location where have saved a file and double-click it to launch.
  • 2. The system will ask if want to run a software – click Run.
  • 3. will be welcomed to a Node.js Setup Wizard – click Next.
  • 4. On next screen, review license agreement. Click Next if agree to the terms and install software.
  • 5. The installer will prompt for an installation location.
  • 6.Leave a default location, unless have a specific need to install it somewhere else – then click Next.
  • 7. The wizard will let select components to include or remove from an installation. Again, unless have a specific need, accept defaults by clicking Next.
  • 8. Finally, click Install button to run installer. When it finishes, click Finish.

Step 3:

  • Verify Installation
  • Open command prompt (or PowerShell), and enter following:
  • node -v
  • The system should be display the Node.js version installed on a system. And can do the same for a NPM:
  • npm -v

How to Update a Node.js and NPM on Windows

  • The simplest way to update Node.js and NPM is to download a latest version of the software.
  • On Node.js download page, right below the Windows Installer link, it will display a latest version.
  • And can compare this to the version have installed.
  • To upgrade, download installer and run it.
  • The setup wizard will overwrite a old version, and replace it with a new version.

How to Uninstall a Node.js and NPM on Windows

Can uninstall Node.js from a Control Panel in Windows.To do so:

1. Click Start button > Settings (gear icon) > Apps.

2. Scroll down to find a Node.js and click to highlight.

3. Select Uninstall. This launches the wizard to uninstall software.

Basic Node.js Usage

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

1. Start by launching the text editor of choice.

2. Next, copy and paste a following into the text editor have 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 a file, then exit. Open PowerShell, and enter the following:

    • node \users\\myprogram.js
    • It will look like a nothing has happened. In reality, a script is running in a background.
    • click Allow.

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

    • In a very upper-left corner, should see a text Hello World!
    • Right now computer is acting like a server.
    • Any other computer that tries to access a system on port 8080 will see Hello World notice.
    • To turn off a program, switch back to the PowerShell and press Ctrl+C.
    • The system will switch back to the command prompt.
    • And can close this window whenever are ready.

    Writing a first program on node.js

    Now that have a successfully downloaded and installed node.js in a system, let’s learn how to write program using node.js Follow steps to write a r first program.

    Step-1: Create the folder and name it. (Here have created the folder named Node Programs.

    Step-2: Open any code editor of the choice (using a Visual Studio Code).

    Step-3: Click on a file menu and open the folder just created.

    Step-4: Once open a folder, create a file and name it. (have created a file named as a welcome.js)

    Step-5: Write a program and save it using (Ctrl + S).

    Step-6: Start a debugging using shortcut f5.

    Conclusion

    • Should now be able to install both Node.js framework, and NPM package manager.
    • Also written a first node.js JavaScript program!
    • The NPM framework gives a access to many various JavaScript solutions.

    Are you looking training with Right Jobs?

    Contact Us

    Popular Courses