question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"npm install karma" fails on windows

See original GitHub issue

I have the latest version of node installed:

C:\>npm -v
2.14.4

C:\>node -v
v4.1.2

I try installing karma via the docs and I get the following console output:

C:\xyz>npm install karma --save-dev

npm WARN optional dep failed, continuing fsevents@1.0.2

> bufferutil@1.2.1 install C:\xyz\node_modules\karma\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil
> node-gyp rebuild


C:\xyz\node_modules\karma\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:116:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:71:11
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\xyz\node_modules\karma\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v4.1.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok

> utf-8-validate@1.2.1 install C:\xyz\node_modules\karma\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate
> node-gyp rebuild


C:\xyz\node_modules\karma\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:116:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:71:11
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\xyz\node_modules\karma\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate
gyp ERR! node -v v4.1.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing bufferutil@1.2.1

> utf-8-validate@1.2.1 install C:\xyz\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate
> node-gyp rebuild


C:\xyz\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:116:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:71:11
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\xyz\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate
gyp ERR! node -v v4.1.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing utf-8-validate@1.2.1

> bufferutil@1.2.1 install C:\xyz\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil
> node-gyp rebuild


C:\xyz\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:116:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:71:11
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\xyz\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v4.1.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing utf-8-validate@1.2.1
npm WARN optional dep failed, continuing bufferutil@1.2.1
karma@0.13.10 node_modules\karma
β”œβ”€β”€ di@0.0.1
β”œβ”€β”€ graceful-fs@4.1.2
β”œβ”€β”€ rimraf@2.4.3
β”œβ”€β”€ mime@1.3.4
β”œβ”€β”€ colors@1.1.2
β”œβ”€β”€ http-proxy@1.11.2 (eventemitter3@1.1.1, requires-port@0.0.1)
β”œβ”€β”€ dom-serialize@2.2.0 (custom-event@1.0.0, void-elements@1.0.0, extend@2.0.1, ent@2.2.0)
β”œβ”€β”€ source-map@0.4.4 (amdefine@1.0.0)
β”œβ”€β”€ useragent@2.1.7 (lru-cache@2.2.4)
β”œβ”€β”€ glob@5.0.15 (path-is-absolute@1.0.0, inherits@2.0.1, inflight@1.0.4, once@1.3.2)
β”œβ”€β”€ minimatch@2.0.10 (brace-expansion@1.1.1)
β”œβ”€β”€ bluebird@2.10.2
β”œβ”€β”€ optimist@0.6.1 (wordwrap@0.0.3, minimist@0.0.10)
β”œβ”€β”€ connect@3.4.0 (utils-merge@1.0.0, parseurl@1.3.0, debug@2.2.0, finalhandler@0.4.0)
β”œβ”€β”€ body-parser@1.14.1 (bytes@2.1.0, content-type@1.0.1, depd@1.1.0, qs@5.1.0, raw-body@2.1.4, on-finished@2.3.0, http-errors@1.3.1, debug@2.2.0, iconv-lite@0.4.12, type-is@1.6.9)
β”œβ”€β”€ expand-braces@0.1.1 (array-uniq@1.0.2, array-slice@0.2.3, braces@0.1.5)
β”œβ”€β”€ chokidar@1.2.0 (path-is-absolute@1.0.0, arrify@1.0.0, glob-parent@2.0.0, async-each@0.1.6, is-glob@2.0.1, is-binary-path@1.0.1, lodash.flatten@3.0.2, readdirp@2.0.0, anymatch@1.3.0)
β”œβ”€β”€ log4js@0.6.27 (async@0.2.10, underscore@1.8.2, semver@4.3.6, readable-stream@1.0.33)
β”œβ”€β”€ lodash@3.10.1
β”œβ”€β”€ socket.io@1.3.7 (debug@2.1.0, has-binary-data@0.1.3, socket.io-parser@2.2.4, socket.io-adapter@0.3.1, engine.io@1.5.4, socket.io-client@1.3.7)
β”œβ”€β”€ core-js@1.2.1
└── memoizee@0.3.9 (lru-queue@0.1.0, next-tick@0.2.2, d@0.1.1, timers-ext@0.1.0, event-emitter@0.3.4, es6-weak-map@0.1.4, es5-ext@0.10.8)

The first error seems to be that there is something configured wrong – but I don’t know what, since there are no steps to configure anything before running the command.

The second error I see is that python is required (there is no mention of this requirement in the docs, is this legitimate? do we really need to install python too?).

I’m guessing the rest of the errors will change once those two are figured out.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
sateffencommented, Oct 31, 2015

But this is no problem with karma itself. I think it’s strange for npm to show optional dependencies a way everyone things it’s a critical error. The karma team can’t do anything about it. The only thing they could do is remove the dependencies, but this would be stupid, and not helpful at all.

I guess this has to be discussed with the guys from npm (pls check if there is already an issue open, I didn’t see one.

2reactions
sateffencommented, Oct 22, 2015

This errors are optional dependencies, so you can ignore them and still use karma.

The point is, that some dependencies try to use some native code, that they want to compile via node-gyp (and node-gyp requires python). But they only try, so if they fail, they fall back to another (slower) implementation.

So this is actually not a problem with karma itself, it’s just the uncool presentation of npm that causes some confusion here I guess.

You do NOT need node-gyp or python for karma.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installing Karma failed - angularjs - Stack Overflow
js 'karma' is not recognized as an internal or external command (so a windows installation). However there seems to be a karma in....
Read more >
Karma - npm
Start using karma in your project by running `npm i karma`. There are 1198 other projects in the npm registry using karma.
Read more >
Troubleshooting - Karma test runner
This is a common Windows issue, the compilation of the native ws module fails. Anyways, ws has a fallback JS implementation which NPM...
Read more >
Karma installation error - Discussion - BMC Community
Karma installation error Β· 1. Run Command Prompt as Administrator. (On Windows, Start --> Right Click on Command Prompt --> Run as Administrator)....
Read more >
Karma | IntelliJ IDEA Documentation - JetBrains
For Windows: npm install -g karma-cli karma init. Answering the questions of the wizard, specify the testing framework to use and the browsers...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found