简体   繁体   中英

How to install Zombie JS on Windows 7? (node.js headless browser)

I am having issues, could you point me in the right direction?

EDIT: This module (Contextify) will not install from npm on Windows. See https://github.com/brianmcd/contextify/issues/10 for more info.

This is because npm doesn't support C++ modules on Windows yet: https://github.com/brianmcd/contextify/issues/14#issuecomment-3577972

Generally I would like to run http://zombie.labnotes.org - for Windows they are suggesting:

On Windows you'll need Cygwin to get access to GCC, Python, etc. Read this for detailed instructions and troubleshooting: https://github.com/joyent/node/wiki/Building-node.js-on-Cygwin-(Windows)

The problem is - they say Cygwin description is outdated and suggest using Visual Studio... Either way I got both and I am taking my chances by using nodejs installer rather that building it from scratch (error doesn't seem related to it) . And here are the steps I'm doing:

1) Installed node.js using installer: http://nodejs.org/#download

2) Got NPM package manager: https://github.com/isaacs/npm

3) Got Python 2.7, Visual Studio 2010 (as some sources indicated C++ compiler as necessary) and Cygwin...

4) As the installer fails at contextify I searched for it

Use the pre-built binary just download the ZIP file at https://github.com/Benvie/contextify/zipball/master , extract it into your node_modules folder, and then rename the folder to "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>

What steps do I need to make in order to make it operational?

If building nodejs from sources to install a package is required then please say it loud :)

Thanks for helping!

This doesn't directly answer your question, but it may help you solve your problem that you wanted to use Zombie.js for and could be good info for other SOers.

At this stage with Node v0.6 you're going to be fighting an uphill battle to get Zombie.js working on Windows. Node v0.8 will make this a bit better with the switch from node-waf to node-gyp .

However, if you want real headless browser environment, you may want to take a look at PhantomJS and CasperJS (testing framework for PhantomJS). It's not a Node module, but it works really well and is a true headless browser unlike Zombie.js which is an emulation of sorts. PhantomJS works well on Windows.

Hope this might help with your site testing/scraping needs for Windows.

I have zombiejs running successfully on a windows box. I didn't have to use cygwin.

I have the following versions on my box:

  • Node 0.8.17
  • Python 2.7.3
  • Visual Studio 2010

After that, make sure you are running the cmd line as administrator and run the install command for zombie.

npm install zombie

If you have Visual Studio 2013 (instead of Visual Studio 2010) add the following to your NPM command:

--msvs_version=2013

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM