0

I had nodejs and karma installed on a 32-bit windows seven box, and it was working fine.

I'm now setting up a 64-bit windows seven box. I ran "npm install -g" in the directory with my "package.json" file.

It installed a lot of packages, but it seemed to get stuck at some point. Here's the end of the output:

npm http 304 https://registry.npmjs.org/commander
> ws@0.4.31 install C:\Users\=myuid=\AppData\Roaming\npm\node_modules\=myuid=\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
C:\Users\=myuid=\AppData\Roaming\npm\node_modules\=myuid=\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild

It is hung here.

Here is my "package.json":

{
  "name": "=myuid=",
  "version": "0.0.0",
  "description": "ERROR: No README.md file found!",
  "main": "karma.conf.js",
  "dependencies": {
"karma-firefox-launcher": "~0.1.0",
"karma-coffee-preprocessor": "~0.1.0",
"karma-phantomjs-launcher": "~0.1.0",
"karma-jasmine": "~0.1.3",
"karma": "~0.10.2",
"karma-coverage": "~0.1.0",
"karma-html2js-preprocessor": "~0.1.0",
"karma-script-launcher": "~0.1.0",
"karma-requirejs": "~0.1.0",
"karma-chrome-launcher": "~0.1.0"
  },
  "devDependencies": {},
  "scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": "",
  "author": "",
  "license": "BSD"
}

What could be the problem here? Anything else I should show here?

Update:

I realized a couple of things that I should have done differently, but I'm still stuck, although with a slightly different problem.

I forgot that running "npm install -g" requires running the shell as administrator, and it's probably not a good idea to run this in a Cygwin bash shell on Windows. I reran "npm install -g karma --force" in a "cmd" run by administrator. This completes without apparent error, but at the end it does not install the "karma.cmd" script in :%HOME%\AppData\Roaming\npm".

David M. Karr
  • 14,317
  • 20
  • 94
  • 199
  • Do you have python on your machine installed? Here it says that `node-gyp` requires pyhton (and few more things in Windows): https://github.com/TooTallNate/node-gyp – MarcoL Apr 10 '14 at 08:26
  • I never had to install that before. I'm now trying to just do "npm install -g karma", and it completes, but it doesn't install the "karma" script in "%HOME%\AppData\Roaming\npm". Looking at the other laptop, it looks like that script is pretty simple, and the script that script calls (in "node_modules/karma/bin") does exist, so it's possible I could just copy this from the other laptop, but I shouldn't have had to do that. – David M. Karr Apr 10 '14 at 22:25
  • Actually, I realized that I had to run the shell as admin, but that doesn't fix this hanging command. – David M. Karr Apr 10 '14 at 22:32
  • I'm making progress, but this always seems to require hacking. It doesn't work out of the box very well. – David M. Karr Apr 11 '14 at 01:14
  • possible duplicate of [How to manually install a node.js module?](http://stackoverflow.com/questions/5778474/how-to-manually-install-a-node-js-module) – Paul Sweatte Apr 30 '14 at 15:18

1 Answers1

2

Make sure you have all the required software to run node-gyp:

You can configure version of Visual Studio used by gyp via an environment variable so you can avoid having to set the --msvs_version=2012 property.

Examples:

  • set GYP_MSVS_VERSION=2012 for Visual Studio 2012
  • set GYP_MSVS_VERSION=2013e (the 'e' stands for 'express edition')

For the full list see - https://github.com/joyent/node/blob/v0.10.29/tools/gyp/pylib/gyp/MSVSVersion.py#L209-294

This is still painful for Windows users of NodeJS as it assumes you have a copy of Visual Studio installed and many end users will never have this. So I'm lobbying Joyent to the encourage them to include web sockets as part of CORE node and also to possible ship a GNU gcc compiler as part of NodeJS install so we can permanently fix this problem.

Feel free to add your vote at:

Tony O'Hagan
  • 21,638
  • 3
  • 67
  • 78