Reputation: 71
*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. *
Upvotes: 6
Views: 168616
Reputation: 1314
Once you have installed nodejs, 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
Alternatively, if npm does not work in Visual studio code, open VS code then press Ctrl+P and type ext install npm script runner
. You have to choose one and install it.
Once installed, restart Visual studio code, go to VS code terminal and type npm start
and browser will start http://localhost:3000.
Upvotes: 8
Reputation: 11721
When you get this error on windows and all existing solutions seem to be correct, i.e. you've
nvm --version
and get a resonsenpm --version
fails as above.Then try the following.
c:/users/YourUserName/AppData/Roaming/npm
c:/users/YourUserName/AppData/Roaming/npm-cache
for good measure.npm install
but instead do.nvm ls
to see which versions of node you havenvm use 22.9.0
for example.This should hopefully fix the npm.
Note: you might just try nvm use [versionNumer]
first before deleting the folders in AppData, but if that failes, then just delete them and hope nvm fixes it for you.
Upvotes: 0
Reputation: 1
I was very frustrated of this issue when I got this error while installing Tailwind CSS. what you need to do is INSTALL Node.js for your platform. https://nodejs.org/en/download/
Upvotes: 0
Reputation: 31
Upvotes: 3
Reputation: 1
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')
Upvotes: 0
Reputation: 11
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!
Upvotes: 1
Reputation: 552
I got a similar situation like run on windows shell throws error but run on other bash terminal gets running successfully
Upvotes: 0
Reputation: 81
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.
Upvotes: 0
Reputation: 1
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
+ CategoryInfo : ObjectNotFound: (npm:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Upvotes: 0