Last Updated : 04 Apr, 2024
Summarize
Comments
Improve
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.
Table of Content
- NodeJS not being installed
- PATH environment variable not set properly
Error:
Due to some error, it might show an error that it cannot find npm when it is run on the terminal.
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.
After you installed the Node check it in the command prompt.
node -v
npm -v
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.
Step 3: Click Environment Variables
Step 4: On System Variables, select Path and click edit
Step 5: Click New and paste the location of your NodeJS runtime
Step 6: Reload your terminal window and now it should be fixed.
npm --version
To check if it is working properly.