kissynode run on windows解决方案,contextify nodejs windows solution

环境:win node v0.6.6 win7 64x

今天安装kissy的node版本时发现,依赖报错

报错代码:

node-waf was unexpected at this time.
npm ERR! error installing contextify@0.0.7
npm ERR! error installing jsdom@0.2.10
npm ERR! Error: ENOENT, no such file or directory 'D:\node.js\node_modules\jsdom
\node_modules_cssom.npm\package\comments.js'
npm ERR! Report this entire log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! npm-@googlegroups.com
npm ERR!
npm ERR! System Windows_NT 6.1.7600
npm ERR! command "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nod
ejs\node_modules\npm\bin\npm-cli.js" "install" "jsdom"
npm ERR! cwd D:\node.js
npm ERR! node -v v0.6.6
npm ERR! npm -v 1.1.0-beta-4
npm ERR! path D:\node.js\node_modules\jsdom\node_modules_cssom.npm\package\co
mments.js
npm ERR! fstream_path D:\node.js\node_modules\jsdom\node_modules_cssom.npm\pa
ckage\comments.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! message ENOENT, no such file or directory 'D:\node.js\node_modules\jsdo
m\node_modules_cssom.npm\package\comments.js'
npm ERR! fstream_stack Object.oncomplete (C:\Program Files\nodejs\node_modules\n
pm\node_modules\fstream\lib\writer.js:204:26)
npm ERR! Error: ENOENT, no such file or directory 'D:\node.js\node_modules\jsdom
\node_modules_request.npm\package\tests\test-body.js'
npm ERR! Report this entire log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! npm-@googlegroups.com
npm ERR!
npm ERR! System Windows_NT 6.1.7600
npm ERR! command "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nod
ejs\node_modules\npm\bin\npm-cli.js" "install" "jsdom"
npm ERR! cwd D:\node.js
npm ERR! node -v v0.6.6
npm ERR! npm -v 1.1.0-beta-4
npm ERR! path D:\node.js\node_modules\jsdom\node_modules_request.npm\package\
tests\test-body.js
npm ERR! fstream_path D:\node.js\node_modules\jsdom\node_modules_request.npm\
package\tests\test-body.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chmod
npm ERR! code ENOENT
npm ERR! message ENOENT, no such file or directory 'D:\node.js\node_modules\jsdo
m\node_modules_request.npm\package\tests\test-body.js'
npm ERR! fstream_stack Object.oncomplete (C:\Program Files\nodejs\node_modules\n
pm\node_modules\fstream\lib\writer.js:285:17)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! D:\node.js\npm-debug.log
npm not ok

于是查询了好多资料,总结如下:

主要是jsdom依赖的contextify是linux的native code,必须在win下重新编译,所以光npm install contextify是不行的

解决方案:

1、下载别人编译的contextify的zip包,https://github.com/Benvie/contextify/zipball/master

将内容保存到node_modules目录中,改名为contextify

2、安装vcredist_x86,下载地址:http://www.microsoft.com/download/en/details.aspx?id=5555

以上方案参考了https://github.com/brianmcd/contextify/issues/12https://github.com/tmpvar/jsdom/issues/378

原文地址:https://www.cnblogs.com/xiziyin/p/2328582.html