I am new to nodejs environment. after installing nodejs in my windows system I tried checking their versions.
node -v
is showing v16.7.0
okay.
but npm -v
is not working.
I don't know why. I tried changing the environmental variable
Path as well but it did not work.
below I showed the result after entering npm -v
in my windows command promt :
Program 'npm.cmd' failed to run: The system cannot find the file specifiedAt line:1
char:1
+ npm -v
At line:1 char:1
+ npm -v
+ CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException
+ FullyQualifiedErrorId : NativeCommandFailed
so please help me, am stuck here the whole day . pardon me if I do any mistake,Thank you :) ?
A solution for your issue would be following these instructions.
Open Command Line terminal
Run the following command:
DISM.exe /Online /Cleanup-Image /RestoreHealth /Source:C:\RepairSource\Windows /LimitAccess
After it finishes successfully run this command:
sfc /scannow
Copy "npm" folder from C:\Program Files\nodejs\node_modules into C:\Users{YourUser}\AppData\Roaming\
then Go to Computer -> Advanced Settings -> Environmental Variables
Add into User "Path" variable new entry: "C:\Program Files\nodejs\node_modules\npm\bin"
Almost there, now add into System "Path" variable 2 new entries:
"C:\Users{YourUser}\AppData\Roaming\npm"
and
"C:\Program Files\nodejs"
npm-v
in a command line to verify npm is working and a version is shown.