12

I have installed nodejs on my windows pc. And it was working fine. But when I tried to install jsdom using "npm install jsdom" I was prompoted by this error.

node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild info it worked if it ends with ok
ERR! Error: Python does not seem to be installed
at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:78:14) at Object.oncomplete (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:66:11) ERR! not ok
npm WARN optional dependency failed, continuing contextify@0.1.2
jsdom@0.2.13 ./node_modules/jsdom
+-- cssom@0.2.3 +-- htmlparser@1.7.5

Can anyone help me regarding this problem?

Scott Weinstein
  • 18,890
  • 14
  • 78
  • 115
Jrubins
  • 249
  • 1
  • 4
  • 11
  • Error: Python does not seem to be installed, seems you have to install python – stewe Apr 02 '12 at 02:47
  • Yes, but after i received the error i downloaded and installed pythong from python.org, however the error still shows up.. thanks – Jrubins Apr 02 '12 at 03:23
  • @stewe Does it need to be a specific version of Python? Should it be Python 2, or Python 3? I'm still trying to figure this out. – Anderson Green Jan 09 '13 at 01:43
  • 1
    If you don't need the full feature-set of jsdom/Contextify, **[Cheerio](http://matthewmueller.github.com/cheerio/)** is: * Much faster * Much easier to install * More resilient to broken HTML (compared with jsdom) * And provides most of the jQuery functions you would use server-side http://matthewmueller.github.com/cheerio/ – Simon East Mar 31 '13 at 07:10
  • You have to install Python 2.x instead of 3.x – AGamePlayer May 25 '13 at 07:29

7 Answers7

14

I had the same issue on Windows 7 (x64 Ultimate), after hours of search and trials, here is how I resolved it. Please follow the steps in the same exact order:

  1. Install Visual Studio 2010/2012 C++ (Express or higher)
  2. Install Windows SDK 7.1
  3. Install "Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1"
  4. Install GTK (C:\GTK)
  5. Install Python (C:\Python27)
  6. Install node.js (x86)
  7. Add [node.js] to path (C:\Program Files (x86)\nodejs\;)
  8. Add [python] to path (C:\Python27\;)
  9. Add [GTK] to path (C:\GTK\bin;)
  10. Add [WindowsSDKDir] System Variable pointing to "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin"
  11. Run "Windows SDK 7.1 Command Prompt" as Administrator
  12. Set environment to x86 using "setenv /x86"
  13. Change directory to "C:\Program Files (x86)\nodejs\"
  14. Run "npm install -g npm"
  15. Run "npm update -g npm"
  16. Run "npm install -g node-gyp"
  17. Run "node-gyp configure build"
  18. Run "npm install jsdom"
  19. Run "npm install ajax"
  20. Run "npm install http-server"
  21. Run "npm install jquery"
  22. Run "npm install xmlhttprequest"
  23. Run "npm update"

I hope this helps.

Quantamax
  • 199
  • 2
  • 8
  • 1
    Works for me though I did not install GTK. Thanks very much for this great answer – AGamePlayer May 28 '13 at 06:53
  • This worked for me too. No GTK here either. A couple snags for me though. In order to install Windows SDK 7.1 I had to make sure to uninstall all Visual Studio 2010 Redistributables. Also, I had to run `node-gyp rebuild --msvs_version=2012`. Thanks! – meub Feb 12 '14 at 14:33
  • I had to add C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin to PATH so setenv works – setec Oct 10 '14 at 13:51
  • Thanks great findings.. too many dependencies for just NodeJS... how about on Mac could it be simpler ? – Jay Sep 23 '15 at 20:29
3

There is a nice guide to getting JSDom working on Windows here: http://www.steveworkman.com/node-js/2012/installing-jsdom-on-windows/

mr.freeze
  • 13,731
  • 5
  • 36
  • 42
1

For windows 8 64-bit, installing zmq and protobuf, the following worked for me:

First, Install Visual Studio 2012

Then, on the command prompt (in your project directory):

SET VisualStudioVersion=11.0
npm install zmq
npm install protobuf
npm install jsdom
ihm
  • 2,789
  • 1
  • 18
  • 6
1

jsdom uses contextify for running JavaScript on the DOM. And contextify requires native C++ compiler. According to the official readme, on Windows platform, one has to install:

  1. A recent copy of the x86 version of Node.js for Windows, not the x64 version. (should be okay by default)
  2. A copy of Visual C++ 2010 Express. (or any newer version)
  3. A copy of Python 2.7, installed in the default location of C:\Python27.
Mason Wan
  • 118
  • 1
  • 8
1

jsdom has a dependency on contextify, which only recently supports windows. You'll need python and a C++ compiler to install it.

You may also need to do the following

npm install -g node-gyp
node-gyp configure
Scott Weinstein
  • 18,890
  • 14
  • 78
  • 115
  • I have cygwin and Mingw installed with c++ compilers, I have also install python from python.org after I have received this error but the error still remains. – Jrubins Apr 02 '12 at 03:22
0

If you have python installed already, you would need to add the python install directory to the PATH environment variable.

Assuming that python.exe is in the C:\Python32\ directory, on the DOS prompt you need to type:

set PATH=%PATH%;C:\Python32\;

and then:

node-gyp configure

should work fine without that error.

jcollum
  • 43,623
  • 55
  • 191
  • 321
rampall
  • 1
  • 1
0

After almost a half year of solving this issue, reading all forums related to this, I finally found the solution.

What I did was simple in my case because I don't use many apps on this computer.

My Windows 8.1 had many programs installed which confused the NodeJS probably (Frameworks, VS addons, etc.).

So I simply did this:

  • Removed all programs from MS, that I installed once.
  • Uninstalled Nodejs
  • For sure I cleaned the registry with CCleaner
  • Removed Python, Node-gyp and other apps related to Node.js

Then I reinstalled Node.js with optimism for JSdom which installed correctly, but crashed while running my project. So I searched for the new error which - again - has a simple solution. I had to install an older version of JSdom.

npm install jsdom@4.2.0

Finally, everything works. Hope that helps anyone with this issue.

Peter
  • 1,589
  • 2
  • 20
  • 27