Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 449
Anubhav Trivedi Avatar asked May 19 '15 06:05

Anubhav Trivedi


People also ask

Why is node not recognized?

Error Causes Two of the main reasons due to which you can encounter the above-mentioned error are: Node. js is not installed on your system. Environment variables are incorrectly set.

How do I fix node is not working?

Make sure the node path is added, if not added it. After doing this restart Visual Studio or open a fresh command prompt. From the command prompt type 'node -v' to echo the node version installed. You can also add the path to node or any other application directly on the command line.


3 Answers

These issues cannot be installed from the Package Manager console, so I had to browse lot of things to fix the issues and finally I got the solution.

Maybe we followed these scenarios

  • Missing Node.js software

  • Wrongly updated Windows environment path

  • Installed in the wrong path

  • Old version of Node.js software

You can download the latest Node.js software here.

Update Path

After installation, automatically create nodejs folder in this path “C:\Program Files (x86)” or “C:\Program Files “.

Open Control Panel -> User Accounts -> Change my environmental variable and verify the path Variable value “C:\Program Files (x86)\nodejs” or “C:\Program Files \nodejs “.

new => user = path => value = C:\Program Files (x86)\nodejs and after apply that.

and close Editor and restart it. it will work correctly.

note :- enter your path instead of copy of this path.

like image 71
Neel Patel Avatar answered Oct 27 '22 07:10

Neel Patel


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

like image 33
Anubhav Trivedi Avatar answered Oct 27 '22 06:10

Anubhav Trivedi


Model for VSCode editor

C:\Program Files\nodejs
C:\Program Files\nodejs\node_modules\npm\bin
  1. Search environment variable.
  2. Add the above paths into the Environment variables (both user variable path and system variable path).
  3. Restart VSCode.
  4. Open a new terminal in VSCode
  5. run node --version output should equal v16.13.0
like image 43
Jithin Puthoorkaran Avatar answered Oct 27 '22 06:10

Jithin Puthoorkaran