If you’ve ever wanted to scrape a web page and extract some information using Node.js, there’s a really useful module called JSDom that parses a document and gives you a DOM that you can then manipulate with YUI or jQuery.
This all works really well… on Linux and OS X. On Windows, Node.js can’t run pre-built native Node.js libraries, so it has to be build by the NPM build service. This is all documented on the JSDom github issue, but for brevity, this is what you have to do to make it work
- Node.js 0.6.12 is required, apparently 0.6.13 will make this easier
- NPM 1.1.8 is required – Node.js is bundled with 1.1.4 so you’ll need to run npm install npm
- Python 2.7 is required – And the python runtime needs to be on the PATH
- Microsoft Visual C++ 2010 is also required – I’ve got the whole Visual Studio installed on my machine, but I think you’ll be able to get away with the distributable package
I believe you’ll also need the node-gyp module installed globallyNode-gyp is included in NPM
That’s a lot of dependencies, but it should all work. Once Python and C++ are installed, the commands you’ll need to run are:
npm install -g npm
npm install -g node-gyp
npm install jsdom
And that’s it. If there are build errors, let me or the JSDom team know.