coreybutler / nvm-windows

A node.js version management utility for Windows. Ironically written in Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VBScript engine issue

ardoramor opened this issue · comments

I've just installed nvm v1.1.0 on Windows 7 64-bit machine. I also installed node 0.12.9 32 and 64-bit versions using nvm. When I try to execute nvm use 0.12.9 64 from command prompt, it gives me the following error:

Can't find script engine "VBScript" for script
"C:\Users\...\AppData\Roaming\nvm\elevate.vbs".

I am able to run wscript and cscript. My system also has VBScript.dll registered and regedit also has the proper path in the value.

I was also able to execute my test script just to make sure that my corporate is not blocking .vbs executions.

Anyone has an idea why this might be happening?

elevate.vbs is a part of NVM and should exist after the installation. Can you verify the file exists?

Additionally, I'd suggest installing another version of Node that's not on the 0.12.x branch. A few users have encountered strange issues with those specific versions of node. If you can install another version (perhaps 0.10.31 or 4.2.1) and successfully use it, it will provide more insight into this issue.

I've checked and elevate.vbs exists:

nvm-dir

But the error still happens when I try to execute use for version 0.11.6:

vbs-engine

I basically happens when nvm tries to setup the symlink to the chosen version.

I'll do some more debugging.

So nvm executes the following command when trying to make symlink:

C:\Users\...\AppData\Roaming\nvm\elevate.cmd cmd /C mklink /D "C:\Program Files\nodejs" C:\Users\...\AppData\Roaming\nvm\v0.11.6

I am able to execute the command myself and it prompts me for permissions. I do not see the VBScript engine error.

Is it possible that GO runs in some different environment? That's the only explanation that comes to my mind.

I don't think this is a Go environment issue (otherwise everyone would have this issue). It could be a problem with the default path of the VBScript engine.

To check, open regedit and check the following key: HKCR\CLSID\{B54F3741-5B07-11cf-A4B0-00AA004A55E8}\InprocServer32. There should be a Default key in there set to C:\Windows\system32\vbscript.dll.

Bottom line: the error message you're receiving is due to a failure to recognize the VBScript engine, not due to the file structure. This usually means there is a permission problem (i.e. the path to VBScript may exist but cannot be read, thus cannot be recognized) or a configuration problem. Since you can run the script manually, I suspect a configuration issue in the registry.

It's just as you mention:

regedit

Ok, I think I found the issue. In Wow6432 node, the corresponding entries have McAfee path. Fixing that should fix the issue.

Ok, it works now. Just for anyone else running across the similar issue, I used MCPR tool (official McAfee): http://service.mcafee.com/FAQDocument.aspx?id=TS101331

I'll reference this in the README in case anyone else runs into this.

For anyone else running into this: it doesn't matter if McAfee is currently installed, if it was ever installed on your system it could have broken it.

If I don't want to uninstall and re-install McAfee, how should I fix the issue?

I had a different issue. Somehow files with ".vbs" extensions got associated with Notepad++. To fix it I opened a cmd shell (run as Administrator) and executed the following:
assoc .vbs=VBSFile

I've never installed McAfee on this system, my registry looks good, .vbs files are associated with Windows Based Script Host, have tried as both my normal user and as admin...

At a complete loss for what the issue is here...

I think I had this problem before but checked the scripts it wanted to run and it was only for creating the symlink. I wrote a small bat-script that sets the symlink instead and that worked for me. I basically use my script instead of calling "nvm use". I still run other commands like "nvm install" etc through the normal nvm.

It basically ends up doing this:
mklink /J "%NVM_SYMLINK%" "%NVM_HOME%\v%1"

I had a different issue. Somehow files with ".vbs" extensions got associated with Notepad++. To fix it I opened a cmd shell (run as Administrator) and executed the following: assoc .vbs=VBSFile

Like @nomadicBlue I had installed Notepad++ and it associated .vbs to itself. Running the command that @nomadicBlue referenced in a command prompt (as administrator) fixed the issue.