如何在Windows 7上安装Zombie JS? (node.js无头浏览器)

时间:2012-03-24 13:00:50

标签: node.js cygwin npm zombie.js

我遇到了问题,你能指出我正确的方向吗?

编辑:此模块(Contextify)不会在Windows上从npm安装。有关详细信息,请参阅https://github.com/brianmcd/contextify/issues/10

这是因为npm还不支持Windows上的C ++模块:https://github.com/brianmcd/contextify/issues/14#issuecomment-3577972

一般来说,我想运行http://zombie.labnotes.org - 对于Windows,他们建议:

  

在Windows上,您需要Cygwin才能访问GCC,Python等。阅读   这有关详细说明和问题排查:https://github.com/joyent/node/wiki/Building-node.js-on-Cygwin-(Windows)

问题是 - 他们说Cygwin描述已经过时并建议使用Visual Studio ......无论哪种方式,我都得到了两个,我正在利用nodejs安装程序而不是从头开始构建它(错误不是似乎与它相关)。以下是我正在做的步骤:

1)使用安装程序安装node.js:http://nodejs.org/#download

2)获得NPM包经理:https://github.com/isaacs/npm

3)获得Python 2.7,Visual Studio 2010(因为有些消息来源表示C ++编译器是必要的)和Cygwin ......

4)由于安装程序在上下文失败,我搜索了it

  

使用预先构建的二进制文件只需下载ZIP文件即可   https://github.com/Benvie/contextify/zipball/master,将其解压缩   您的node_modules文件夹,然后将该文件夹重命名为“contextify”

c:\Program Files (x86)\nodejs>node --version
v0.6.13

c:\Program Files (x86)\nodejs>npm install zombie
npm http GET https://registry.npmjs.org/zombie
npm http 304 https://registry.npmjs.org/zombie
npm http GET https://registry.npmjs.org/ws
npm http GET https://registry.npmjs.org/jsdom/0.2.10
npm http GET https://registry.npmjs.org/mime
npm http GET https://registry.npmjs.org/coffee-script
npm http 304 https://registry.npmjs.org/ws
npm http 304 https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/jsdom/0.2.10
npm http 304 https://registry.npmjs.org/coffee-script

> ws@0.4.10 preinstall c:\Program Files (x86)\nodejs\node_modules\zombie\node_mo
dules\ws
> make

        1 file(s) copied.
        1 file(s) copied.
npm http GET https://registry.npmjs.org/commander/0.5.0
npm http GET https://registry.npmjs.org/options
npm http 304 https://registry.npmjs.org/options
npm http 304 https://registry.npmjs.org/commander/0.5.0
npm http GET https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/htmlparser
npm http GET https://registry.npmjs.org/cssom
npm http 304 https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/htmlparser
npm http 304 https://registry.npmjs.org/request
npm http 304 https://registry.npmjs.org/cssom

> contextify@0.0.7 preinstall c:\Program Files (x86)\nodejs\node_modules\zombie\
node_modules\jsdom\node_modules\contextify
> node-waf clean || (exit 0); node-waf configure build

node-waf was unexpected at this time.

npm ERR! Error: ENOENT, chmod 'c:\Program Files (x86)\nodejs\node_modules\zombie
\node_modules\jsdom\node_modules\request\tests\squid.conf'
npm ERR! You may report this 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 (x86)\\nodejs\\\\node.exe" "c:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "zombie"
npm ERR! cwd c:\Program Files (x86)\nodejs
npm ERR! node -v v0.6.13
npm ERR! npm -v 1.1.9
npm ERR! path c:\Program Files (x86)\nodejs\node_modules\zombie\node_modules\jsd
om\node_modules\request\tests\squid.conf
npm ERR! fstream_path c:\Program Files (x86)\nodejs\node_modules\zombie\node_mod
ules\jsdom\node_modules\request\tests\squid.conf
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chmod
npm ERR! code ENOENT
npm ERR! message ENOENT, chmod 'c:\Program Files (x86)\nodejs\node_modules\zombi
e\node_modules\jsdom\node_modules\request\tests\squid.conf'
npm ERR! errno {}
npm ERR! fstream_stack Object.oncomplete (c:\Program Files (x86)\nodejs\node_mod
ules\npm\node_modules\fstream\lib\writer.js:285:17)

npm ERR! Error: ENOENT, lstat 'c:\Program Files (x86)\nodejs\node_modules\zombie
\node_modules\jsdom\node_modules\htmlparser\runtests.html'
npm ERR! You may report this 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 (x86)\\nodejs\\\\node.exe" "c:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "zombie"
npm ERR! cwd c:\Program Files (x86)\nodejs
npm ERR! node -v v0.6.13
npm ERR! npm -v 1.1.9
npm ERR! path c:\Program Files (x86)\nodejs\node_modules\zombie\node_modules\jsd
om\node_modules\htmlparser\runtests.html
npm ERR! fstream_path c:\Program Files (x86)\nodejs\node_modules\zombie\node_mod
ules\jsdom\node_modules\htmlparser\runtests.html
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! message ENOENT, lstat 'c:\Program Files (x86)\nodejs\node_modules\zombi
e\node_modules\jsdom\node_modules\htmlparser\runtests.html'
npm ERR! errno {}
npm ERR! fstream_stack Object.oncomplete (c:\Program Files (x86)\nodejs\node_mod
ules\npm\node_modules\fstream\lib\writer.js:204:26)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     c:\Program Files (x86)\nodejs\npm-debug.log
npm not ok

c:\Program Files (x86)\nodejs>

我需要采取哪些步骤才能使其正常运作?

如果需要从源代码构建nodejs来安装软件包,那么请大声说:)

感谢您的帮助!

3 个答案:

答案 0 :(得分:10)

这并不直接回答您的问题,但它可以帮助您解决您想要使用Zombie.js的问题,并且可能是其他SO的好信息。

在Node v0.6的这个阶段,你将面临一场艰苦的战斗,让Zombie.js在Windows上工作。从node-wafnode-gyp的切换,节点v0.8会更好一些。

但是,如果您想要真正的无头浏览器环境,您可能需要查看PhantomJSCasperJS(PhantomJS的测试框架)。它不是一个Node模块,但它工作得很好,是一个真正的无头浏览器,不像Zombie.js,它是一种模拟。 PhantomJS在Windows上运行良好。

希望这可能有助于您对Windows的网站测试/抓取需求。

答案 1 :(得分:9)

我在Windows机器上成功运行了zombiejs。我没有必要使用cygwin。

我的盒子上有以下版本:

  • 节点0.8.17
  • Python 2.7.3
  • Visual Studio 2010

之后,请确保以管理员身份运行cmd行并运行zombie的install命令。

npm install zombie

答案 2 :(得分:1)

如果您有Visual Studio 2013(而不是Visual Studio 2010),请在NPM命令中添加以下内容:

- msvs_version = 2013