npm : The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program

Viewed 30372

*when i check node -v it's alright and prints out. But npm is shows this error. How can I fix this? Please help me. *

enter image description here

6 Answers

I searched a lot of time and found solutions.
once installed nodejs -> Kindly restart the laptop
then set the path (system properties -> environment settings -> C:\Program Files\nodejs)
now open cmd and type -> C:\Users\solomon\Desktop\react-project>npm start it will work by opening browser with http://localhost:3000

or

if npm not works in Visual studio code
open vs code then Ctrl+P -> type - ext install npm script runner
you have to choose one and install it. once installed please close and open Visual studio code
and go to vs code terminal and type npm start and browser will start http://localhost:3000
Wow its works great.

npm : The term 'npm' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

  • npm install
  •   + CategoryInfo          : ObjectNotFound: (npm:String) [], CommandNotFoundException       
      + FullyQualifiedErrorId : CommandNotFoundException
    

I'm using nvm for the usage of the different versions of node. As a fresh installation, I've installed node version X but didn't apply "use" command for this node version.

Command "nvm ls" should return an asterisk before the current node version.

I got a similar situation like run on windows shell throws error but run on other bash terminal gets running successfully

This is how I solved it. Incase of next time

Open the Control Panel (Click the Start button, then click Control Panel)

Click User Accounts

Click Change my environment variables

Select PATH and click the Edit... button At the end of the Variable value, add; C:\Program Files\nodejs

Click Ok on the "Edit User Variable" window, then click Ok on the "Environment Variables" window

Start a command prompt window (Start button, then type cmd into the search and hit enter)

At the prompt (C:>) type npm and hit enter; you should now see some help text (Usage: npm etc.) rather than "npm is not recognized..." Now you can start using npm!

make sure you've installed the node package manager -> navigate to start menu 1- search for "Environment Variables". 2- navigate to "System Variable" Box. 3- Click on "PATH" -> "Edit" 4- Press New -> Browse 5- Add The Path of the node (Most Likely you'll find it in 'C:/ program files')

Related