nvmw install 失败. 需修改"Msxml2.XMLHTTP"为"Msxml2.ServerXMLHTTP"

时间:2022-11-17 01:57:14

准备在windows下学习nodejs. 下载了nvmw . 但没法安装node的任何版本. 都是报错如下:

C:\Users\WXG>nvmw install v0.12.0 x86
Start installing node/v0.12.0 (x32) to E:\wxg\Git\nvmw\v0.12.0-x32
Download from http://npm.taobao.org/mirrors/node/v0.12.0/node.exe, and save it as E:\wxg\Git\nvmw\v0
.12.0-x32\node.exe
0 Unknown
Download E:\wxg\Git\nvmw\v0.12.0-x32\node.exe from http://npm.taobao.org/mirrors/node/v0.12.0/node.e
xe failed

C:\Users\WXG>nvmw install node-v0.11.15
Start installing node/v0.11.15 (x64) to E:\wxg\Git\nvmw\v0.11.15
Download from http://npm.taobao.org/mirrors/node/v0.11.15/x64/node.exe, and save it as E:\wxg\Git\nv
mw\v0.11.15\node.exe
0 Unknown
Download E:\wxg\Git\nvmw\v0.11.15\node.exe from http://npm.taobao.org/mirrors/node/v0.11.15/x64/node
.exe failed

网上找不到类似错误,的解决办法. 幸好源码不多而且比较好懂. 我试着去定位问题的位置.

然后发现出错在"fget.js"上.  需要修改下源文件.  'Msxml2.XMLHTTP' 改为 'Msxml2.ServerXMLHTTP'   注: 我是win7 64 位系统.

function downloadFile(url, filename, callback) {
  //var xhr = WScript.createObject('Msxml2.XMLHTTP')
  var xhr = WScript.createObject('Msxml2.ServerXMLHTTP')
    , ostream = new ActiveXObject("Adodb.Stream");

  log('Download from ' + url + ', and save it as ' + filename);

  xhr.onreadystatechange = function() {

以下是我的调试截图:

nvmw install 失败. 需修改"Msxml2.XMLHTTP"为"Msxml2.ServerXMLHTTP"

nvmw install 失败. 需修改"Msxml2.XMLHTTP"为"Msxml2.ServerXMLHTTP"

nvmw install 失败. 需修改"Msxml2.XMLHTTP"为"Msxml2.ServerXMLHTTP"