Ruby - ExecJS not loading (I have the proper materials and PATH location.) [Windows]

I am having a problem with the ExecJS in that it is unable to locate a required Runtime. I am using Windows, and I have both Windows CScript and Node.js installed on my computer, but neither of these guys are being invoked.

As a result, I am unable to run any rails task that involves this (I cannot even load my rake list in RubyMine to call actions such as db:create to create my databases from a fresh project.)

I am capable of accessing both csript and node from the command line, and I have checked my environment variables and their proper file locations are in the PATH. There's something else ruining my ability to use ExecJS. Has anyone else had a similar experience where you have had all of the right stuff, but something is still going wrong?

When Ruby spawns child process to invoke CScript or Node, it will use the same rules that allow cmd.exe execute them from the command line.

But, sometimes, stuff in your registry or your environment variables can affect this process.

At RubyInstaller project we collected a series of troubleshooting items that could possible be the culprit.

Please check that COMSPEC environment variable is set to use cmd.exe and nothing like TCC/LE or other stuff.

C:\>SET COMSPEC

Also, check that your registry do not contain an AutoRun key, which will also affect Ruby.

C:\>REG QUERY "HKCU\Software\Microsoft\Command Processor"
C:\>REG QUERY "HKLM\Software\Microsoft\Command Processor"

If you see a key AutoRun in one of the above commands, that means something is setup to automatically execute everytime a new cmd.exe is started, which is bad for some cases.

Please follow the instructions in the Troubleshooting page on how to remove it.

This also affects gem installation that requires compilation, but if is not failing for you then the problem might be something else.

Hope that helps.

I was having similar problems, my basic skeleton app wouldn't run despite having Node.js installed, and then trying therubyracer gem. Finally I decided to use my troubleshooting mantra with windows, "When in doubt, run as admin". So I ran my rails cmd as an admin and it worked fine after that.