Open In App

How to Fix npm path in Windows 8 and 10 ?

Last Updated : 04 Apr, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Node Package Manager (npm) is a package manager for managing dependencies and packages in Node.js projects. However, users often encounter issues with npm commands not being recognized in Windows 8 and 10 due to path configuration problems.

In this article, we’ll discuss the following approaches to fix the npm path issue.

Error:

Due to some error, it might show an error that it cannot find npm when it is run on the terminal.

Screenshot-2024-03-19-111616

Error when Power Shell cannot find the npm command

Reason for error in NPM:

1. NodeJS not being installed.

2. PATH environment variable not set properly.

Approach 1: NodeJS not being installed

The error can be occour if you haven’t install node in your system.

  • Make sure to install NodeJS from here.
  • You can follow the step from this article.

After you installed the Node check it in the command prompt.

node -v
npm -v

fghn

NodeJS not being installed

Approach 2: PATH environment variable not set properly

The PATH environment variable tells the command line where executable binaries are located.

To set the PATH for node.js and npm follow these steps:

Step 1: Get the installed location of your NodeJS runtime.

By default it is:

C:\Program Files\nodejs

Step 2: Search for environment variables in the global search.

Screenshot-2024-03-19-113854

Edit environment variables search on windows 10

Step 3: Click Environment Variables

Screenshot-2024-03-19-114112

System Properties panel

Step 4: On System Variables, select Path and click edit

Screenshot-2024-03-19-114412

System Variables

Step 5: Click New and paste the location of your NodeJS runtime

Screenshot-2024-03-19-115003

Entering path of nodejs

Step 6: Reload your terminal window and now it should be fixed.

npm --version 

To check if it is working properly.

Screenshot-2024-03-19-115427

working npm command


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads