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.

typings ERR! caused by certificate not trusted

 

I happened to fix this issue by creating a file named “.typingsrc” with the following contents in my project’s root directory

 

{

                "rejectUnauthorized": false,

                "registryURL": "http://api.typings.org/"

}

 

Good luck

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.