Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

> [email protected] 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

> [email protected] 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!     <[email protected]>
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!     <[email protected]>
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!

like image 973
Mars Robertson Avatar asked Mar 24 '12 13:03

Mars Robertson


People also ask

Is Jsdom a headless browser?

JSDOM is a JavaScript based headless browser that can be used to create a realistic testing environment. Since enzyme's mount API requires a DOM, JSDOM is required in order to use mount if you are not already in a browser environment (ie, a Node environment).

What is Zombie JS?

Zombie. js is a lightweight framework for testing client-side JavaScript code in a simulated environment. No browser required.

What is headless node JS?

What is a Node. js Headless CMS? A Node. js headless CMS is a content management system that doesn't have a front-end user interface. It will typically only have a back-end user interface where an admin will login in manage content and site assets such as images and videos.

Can you run node js in browser?

That's right: the Node. js runtime itself is running natively, inside the browser, for the first time ever. You can try it out for yourself over at StackBlitz.com or by clicking one of the starter projects below. Boot a Node.


3 Answers

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.

like image 180
JP Richardson Avatar answered Oct 04 '22 01:10

JP Richardson


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

like image 33
Joey V. Avatar answered Oct 04 '22 00:10

Joey V.


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

--msvs_version=2013

like image 23
EricP Avatar answered Oct 04 '22 02:10

EricP