How to Fix npm path in Windows 8 and 10 ?
Last Updated :
04 Apr, 2024
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.
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
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.
Edit environment variables search on windows 10
Step 3: Click Environment Variables
System Properties panel
Step 4: On System Variables, select Path and click edit
System Variables
Step 5: Click New and paste the location of your NodeJS runtime
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.
working npm command
Share your thoughts in the comments
Please Login to comment...