Install JSDOM On Windows
JSDOM is an awesome node package for simulating a browser environment. It’s a NodeJS implementation of the DOM that makes it super easy to work with pages retrieved from the Internet. Unfortunately, JSDOM relies on a node package called Contextify that is difficult to get working in Windows.
Before beginning, make sure you’ve got the following installed on your system:
- A recent copy of the x86 version of Node.js for Windows
- Python 2.7 installed in C:\Python27
- Visual Studio 2012 C++ (Express or higher) installed
These are the steps I took to get it JSDOM installed. A lot of this has been taken from StackOverflow…
-
Uninstall any/all Visual Studio 2010 Redistibutables
-
Install Windows SDK 7.1
-
Install Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1
-
Add node.js and python to your path:
C:\Program Files (x86)\nodejs\;C:\Python27\;
-
Check to see where Windows SDK 7.1 was installed and add a System Variable called WindowsSDKDir for it. It will most likely be in:
C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin
orC:\Program Files (x86)\Microsoft SDKs\Windows\v7.1\Bin
. -
Run “Windows SDK 7.1 Command Prompt” as Administrator
-
Run the following commands (the node-gyp configure build will probably fail at first, but the rebuild/reinstall should succeed):
setenv /x86
cd C:\Program Files (x86)\nodejs\
npm install -g npm
npm update -g npm
npm install -g node-gyp
node-gyp configure build
node-gyp rebuild --msvs_version=2012
npm install -g node-gyp
npm install -g jsdom