【问题标题】:How to install Zombie JS on Windows 7? (node.js headless browser)如何在 Windows 7 上安装 Zombie JS? (node.js 无头浏览器)
【发布时间】:2012-04-08 18:24:51
【问题描述】:

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

编辑:此模块 (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) 由于安装程序在 contextify 中失败,我搜索了 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 来安装包,请大声说出来:)

感谢您的帮助!

【问题讨论】:

    标签: node.js cygwin npm zombie.js


    【解决方案1】:

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

    在使用 Node v0.6 的这个阶段,您将进行一场艰苦的战斗,以使 Zombie.js 在 Windows 上运行。从 node-waf 切换到 node-gyp 后,Node v0.8 将使它变得更好。

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

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

    【讨论】:

    • 如果我需要支持cookies怎么办? stackoverflow.com/questions/9504765/…(然后我会运行 Ubuntu)
    • 它适用于 Cookie。只是 PhantomJS 脚本本身无法访问 cookie。即,您在 PhantomJS 中打开的任何网页都可以使用 cookie,而不是您的 PhantomJS 脚本。
    • 好吧,那就试一试。我担心我什至无法接受 cookie:code.google.com/p/phantomjs/issues/detail?id=91 感谢您的帮助!
    【解决方案2】:

    我在 windows 盒子上成功运行了zombiejs。我不必使用 cygwin。

    我的盒子上有以下版本:

    • 节点 0.8.17
    • Python 2.7.3
    • Visual Studio 2010

    之后,确保您以管理员身份运行 cmd 行并运行僵尸的安装命令。

    npm install zombie

    【讨论】:

    • Visual Studio 2010 对我来说是关键!由于某种原因,Visual Studio 2012 不起作用..
    • Python 2.7 + VS2012 为我完成了这项工作。有点奇怪。
    • 与上面的 Ed Woodcock 相同,在 Python 2.7.3 上对我来说效果很好。祝大家好运。
    • Python 2.7.7 + VS2013 - 没用; Python 2.7.7 + VS2010 - 成功!
    【解决方案3】:

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

    --msvs_version=2013

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-25
      • 2011-09-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多