Pages

Thursday, December 29, 2016

'node' is not recognized as an internal or external command, operable program or batch file - even after installing node in Windows

Though I had admin priviledges, the corporate firewall and the group policies kept haunting me and were a great hurdle preventing me from setting up a proper node workspace

 

My frustrations kept sky rocketing when I kept receiving the error messages as present in the following screen shot

 

 

Not being used to work with the windows command line, it was a head ache and after lot of waiting, thinking and research, I figured out to stick with what I know best and use the same to my advantage.

 

I never got lucky with setting the correct path for the variables etc, but I ended up writing a batch file that will let me work with some what similar environment.

 

For example I created a command file which I named “installNodeKeys.cmd” in memory of the  famous old days of using “Doskey.exe” in command prompt and added the following code to it

 

@echo off

rem use %node% instead of node

prompt $$

set node=d:\dev\tools\nodeCircle\nodejs\node.exe

cls

 

 

Later I got the file to grow pointing to more executable files. But be warned, you may want to traverse through all the installed packages and replace node with %node% and other commands with their corresponding %command%.

 

@echo off

rem use %node%, %npm% , %tsc% ect instead of node, npm, tsc etc in the command terminal

prompt $$

set node=d:\dev\tools\nodeCircle\nodejs\node.exe

set npm=d:\dev\tools\nodeCircle\nodejs\npm

set tsc=D:\dev\workspace\typescriptWorkspace\node_modules\.bin\tsc.cmd

set subl="D:\softwares\editors\Sublime Text Build 3126\subl"

set babel="D:\dev\workspace\babelWorkspace\node_modules\.bin\babel.cmd"

cls

 

This may not be the best solution. At least this helped me create a working environment that let me learn Angular 2 and React JS.

2 comments:

  1. salg kopi eksklusive klokker, der kombinerer elegant stil og avanceret teknologi, en række forskellige stilarter af salg bell-and-ross kopi eksklusive klokker, går markøren mellem din eksklusive smagstil.

    ReplyDelete