windowsnode.jspowershellnpm

The term 'node' is not recognized... In Powershell


I have been trying to resolve this issue for the whole day.

When I run node -v or npm install in cmd prompt, it works absolutely fine. But when I run the same commands in Powershell, it gives the following error:s

PS C:\Users\Anubhav.Trivedi> node -v
The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelli
ng of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:5
+ node <<<<  -v
    + CategoryInfo          : ObjectNotFound: (node:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I tried uninstalling node js and reinstalling it. Added node js path C:\Program Files (x86)\nodejs\ to enviroment variables (system variables). Restarting computer. But nothing seems to work. Kindly let me know, what am I missing here.


Solution

  • As dan-gph mentioned check the Path in environment variable using script $env:path -split ';' | Select-String nodejs and once you update the Path in environment variable, make sure to restart powershell and also restart explorer.exe. This would resolve the issue.

    If you still face issues, check which nodejs you have installed (32bit or 64bit). Install 32 bit only as powershell or cmd are 32bit programs