Command "npm" is not recognized by Command Prompt

Asked

Viewed 51,063 times

8

I have a project with a package.json, in it I have everything configured.

I just cloned that same project on another machine, man git clone worked smoothly.

But when I give the command npm install in the CMD to include the modules I will use, the following message appears:

'npm' is not recognised as an internal command or external, a operable program or a batch file.

Does anyone know how to solve?

5 answers

14

I can see two possible problems:

  1. Nodejs is not installed
  2. Nodejs is not in the variable PATH windows environment

In the second case try to add C:/Program Files/nodejs (or the directory where Node was installed) to the environment variable.

Behold: https://github.com/joyent/node/issues/4356

  • Or any other way you have installed your Node

  • So I checked my environment variables, and they were right.. I believe it was something on the network. I was at home and it wasn’t working. When I got to college, and ran the "npm install" he downloaded the dependencies.. But thanks guy!

4

Install Node.js on your app’s target machine, this will solve your problem.

3

On Windows 64 Bits - En:
Open Run and type:
C: Windows Syswow64 cmd.exe
In the Command Prompt that opens, type:
CD ..
CD ..
CD Program Files
CD nodejs
npm install -g phonegap

3

If Node is installed and npm is still not recognized it is very likely (for some reason) that the system path has not been updated.

at command prompt (CMD) type " npm config get prefix " to check where the npm folder is, for example: "C: Users "your user name" Appdata Roaming npm" and add this information in the path.

to change the path, with the file explorer open, right-click on "This Computer", in the system window click on "Advanced System Settings", in system properties click on "Environment Variables" open the "Path" variable, click on "New" and add the npm path.

hope I’ve helped.

1

Try the following command:

node -v

In case the version is not displayed, please install Node. I had the same problem and as soon as I installed it, I had to restart the project in vs code.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.