Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install npm on Windows

This guide shows you how to get npm on Windows. The easy way is to install Node.js, because npm comes inside it.

Windows Hosting2 min read15 steps

What is npm?

npm stands for Node Package Manager. A package is a bundle of ready-made code that someone else wrote. npm downloads these packages for you, like an app store for code. Node.js is the program that runs JavaScript outside the browser. npm needs Node.js to work.

Steps

  1. Open your browser and go to nodejs.org.
  2. Download the Windows installer marked LTS. LTS is the stable version for most people.
  3. Double-click the file you downloaded.
  4. Click Next on the first screen and accept the license.
  5. Keep the default folder and click Next.
  6. On the features page, check that npm package manager and Add to PATH are included. PATH is the list of folders where Windows finds programs.
  7. Click Next, then Install.
  8. Click Yes if Windows asks for permission.
  9. Click Finish.

Check the install

  1. Open a new Command Prompt.
  2. Type this and press Enter:
    npm -v
    This prints the npm version number.
  3. Also check Node.js:
    node -v

Try npm

  1. Make a folder, for example C:\myapp, and open Command Prompt there:
    mkdir C:\myapp
    cd C:\myapp
    These lines create the folder and enter it.
  2. Start a project:
    npm init -y
    This creates a file named package.json that lists your project.
  3. Install a package:
    npm install lodash
    This downloads a helper package called lodash into a folder named node_modules.

Update npm

npm install -g npm@latest

This command installs the newest npm for your whole computer.

Common problems

  • "npm is not recognized": Close the window and open a new one. Or restart the computer.
  • Script is disabled in PowerShell: Use Command Prompt instead. Or ask your admin to change the PowerShell policy.
  • Permission errors: Open Command Prompt as administrator.
Tip: You do not need to install npm alone. Updating Node.js also updates npm.

Quick recap

  • npm comes with Node.js.
  • Install the LTS version from nodejs.org.
  • Check with npm -v in a new Command Prompt.
  • Use npm install to add packages.