npm command not found in Windows 10

Viewed 16456

I have installed node.js in my computer. I can check the node and npm version in my cmd. I am using laravel homestead with vagrant in windows 10. however. When I use git bash the node version is shown buy the npm is not recognized returning a message saying npm: command not found.

I do appreciate any help.

2 Answers
  1. The error above happens when the Windows operating system doesn’t know what to do with the npm command.

  2. To fix the error, you need to make sure that the Node executable file is available under your PATH setting.

  3. Note: NodeJS should have added the executable location to your PATH variable during installation process, but sometimes it may fail to do so.

You can add new entry to the Windows PATH environment variable using the Command Prompt as follows:

> SET PATH=C:\Program Files\Nodejs;%PATH% 
> npm 
Related