2

I had a working installation of Karma on a 32-bit Win7 box. I got it working, but it took many twisty passages to get it all working. I run it from Maven.

I'm now setting it up on a 64-bit Win7 box. I've managed to get Karma installed and running, and even passing my tests, but most of my required plugins are getting "Cannot find plugin" warnings. Note that I haven't changed anything in the build script itself. This is working unchanged on the 32-bit box.

Here's a sample of my build output:

[INFO] --- maven-karma-plugin:1.5:start (default) @ SunlightGUI-war ---
cmd /C karma start C:\Users\=myuid=\workspace\SunlightGUI\src\test\webapp\js\karma.conf.js --browsers PhantomJS --reporters dots,junit,coverage --single-run --no-auto-watch --colors false
WARN [plugin]: Cannot find plugin "karma-coverage". 
  Did you forget to install it ? 
  npm install karma-coverage --save-dev 
WARN [plugin]: Cannot find plugin "karma-junit-reporter". 
  Did you forget to install it ? 
  npm install karma-junit-reporter --save-dev 
WARN [plugin]: Cannot find plugin "karma-ie-launcher". 
  Did you forget to install it ? 
  npm install karma-ie-launcher --save-dev 
WARN [reporter]: Can not load "junit", it is not registered! 
  Perhaps you are missing some plugin? 
WARN [reporter]: Can not load "coverage", it is not registered! 
  Perhaps you are missing some plugin? 
INFO [karma]: Karma v0.10.10 server started at http://localhost:9876/ 
INFO [launcher]: Starting browser PhantomJS 
WARN [preprocess]: Can not load "coverage", it is not registered! 
  Perhaps you are missing some plugin? 
INFO [PhantomJS 1.9.7 (Windows 7)]: Connected on socket QADs66EmM2NRD8wGWyJu 
LOG: LOG 
 'JQMIGRATE: Logging is active'LOG: WARN 
 'JQMIGRATE: jQuery.browser is deprecated'LOG: WARN 
 'JQMIGRATE: AJAX events should be attached to document: ajaxComplete'................... 
PhantomJS 1.9.7 (Windows 7): Executed 19 of 19 SUCCESS (1.708 secs / 0.049 secs) 

So tackling the first one, in a cmd window run by Administrator, I run "npm install -g karma-coverage" and get the following:

c:\Users\=myuid=\workspace\SunlightGUI>npm install -g karma-coverage
npm http GET https://registry.npmjs.org/karma-coverage
npm http 304 https://registry.npmjs.org/karma-coverage
npm http GET https://registry.npmjs.org/istanbul
npm http GET https://registry.npmjs.org/ibrik
npm http GET https://registry.npmjs.org/dateformat
npm http 304 https://registry.npmjs.org/ibrik
npm http 304 https://registry.npmjs.org/istanbul
npm http 304 https://registry.npmjs.org/dateformat
npm http GET https://registry.npmjs.org/estraverse
npm http GET https://registry.npmjs.org/which
npm http GET https://registry.npmjs.org/coffee-script-redux/2.0.0-beta8
npm http GET https://registry.npmjs.org/escodegen
npm http GET https://registry.npmjs.org/lodash
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/escodegen
npm http GET https://registry.npmjs.org/fileset
npm http GET https://registry.npmjs.org/resolve
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/esprima
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/which
npm http GET https://registry.npmjs.org/handlebars
npm http GET https://registry.npmjs.org/wordwrap
npm http GET https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/js-yaml
npm http 304 https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/coffee-script-redux/2.0.0-beta8
npm http 304 https://registry.npmjs.org/which
npm http 304 https://registry.npmjs.org/estraverse
npm http 304 https://registry.npmjs.org/escodegen
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/escodegen
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/which
npm http 304 https://registry.npmjs.org/fileset
npm http 304 https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/esprima
npm http 304 https://registry.npmjs.org/handlebars
npm http 304 https://registry.npmjs.org/nopt
npm http 304 https://registry.npmjs.org/wordwrap
npm http GET https://registry.npmjs.org/esutils
npm http 304 https://registry.npmjs.org/resolve
npm http GET https://registry.npmjs.org/source-map
npm http GET https://registry.npmjs.org/minimist
npm http 304 https://registry.npmjs.org/js-yaml
npm http GET https://registry.npmjs.org/StringScanner
npm http GET https://registry.npmjs.org/esmangle
npm http GET https://registry.npmjs.org/source-map/0.1.11
npm WARN optional dep failed, continuing cscodegen@git://github.com/michaelficar
ra/cscodegen.git#73fd7202ac086c26f18c9d56f025b18b3c6f5383
npm http 304 https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/argparse
npm http 304 https://registry.npmjs.org/source-map
npm http GET https://registry.npmjs.org/uglify-js
npm http 304 https://registry.npmjs.org/source-map/0.1.11
npm http 304 https://registry.npmjs.org/esmangle
npm http 304 https://registry.npmjs.org/esutils
npm http 304 https://registry.npmjs.org/minimist
npm http 304 https://registry.npmjs.org/StringScanner
npm http 304 https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/amdefine
npm http 304 https://registry.npmjs.org/argparse
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/escope
npm http GET https://registry.npmjs.org/esshorten
npm http 304 https://registry.npmjs.org/uglify-js
npm http GET https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/underscore.string
npm http 304 https://registry.npmjs.org/amdefine
npm http 304 https://registry.npmjs.org/lru-cache
npm http 304 https://registry.npmjs.org/sigmund
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/esshorten
npm http 304 https://registry.npmjs.org/underscore.string
npm http 304 https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/escope
npm ERR! peerinvalid The package karma does not satisfy its siblings' peerDepend
encies requirements!
npm ERR! peerinvalid Peer karma-chrome-launcher@0.1.3 wants karma@>=0.9.3
npm ERR! peerinvalid Peer karma-coffee-preprocessor@0.2.1 wants karma@>=0.11.14
npm ERR! peerinvalid Peer karma-coverage@0.2.1 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-firefox-launcher@0.1.3 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-html2js-preprocessor@0.1.0 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-ie-launcher@0.1.5 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-jasmine@0.1.5 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-phantomjs-launcher@0.1.4 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-requirejs@0.2.1 wants karma@>=0.9
npm ERR! peerinvalid Peer karma-script-launcher@0.1.0 wants karma@>=0.9
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "karma-coverage"
npm ERR! cwd c:\Users\=myuid=\workspace\SunlightGUI
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code EPEERINVALID
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     c:\Users\=myuid=\workspace\SunlightGUI\npm-debug.log
npm ERR! not ok code 0
c:\Users\=myuid=\workspace\SunlightGUI>

And here is my "karma.conf.js":

module.exports = function(config) {
    'use strict';
  config.set({
basePath: '../../../..',
frameworks: ['jasmine'],
files: [
...
    ],
exclude: [
],
plugins:[
     'karma-jasmine',
     'karma-coverage',
     'karma-junit-reporter',
     'karma-phantomjs-launcher',
     'karma-chrome-launcher',
     'karma-firefox-launcher',
     'karma-ie-launcher'
     ],
preprocessors: {
    "src/main/webapp/js/mylibs/*.js": 'coverage',
    "src/main/webapp/js/diag/*.js": 'coverage',
},
coverageReporter: {
    type: "lcov",
    dir: "target/karma-coverage"
},
junitReporter: {
    outputFile: 'target/surefire-reports/TEST-karma.xml'
},
reporters: ['dots', 'junit'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
captureTimeout: 60000,
singleRun: false
  });
};

Update:

For completeness, here is my "package.json", but after my attempt at just using "npm install -g" failed, I deleted my "node_modules" and just did "npm install -g karma".

{
  "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"
}

I think I'm going to start over, deleting my "node_modules" and then "npm install -g karma@0.10.2" (the last stable version that I know worked) and then "karma init".

David M. Karr
  • 14,317
  • 20
  • 94
  • 199
  • Could you post your `package.json` file content? I think it's related to this issue: https://github.com/karma-runner/karma/issues/940 – glepretre Apr 11 '14 at 17:28
  • Wow. What a mess (reading the ticket). I'll post it, but after I hit the initial problems, I deleted my "node_modules" and tried to directly install karma. From that ticket, I still have no idea how to move forward. – David M. Karr Apr 11 '14 at 17:38
  • possible duplicate of [npm ERR: peerinvalid The package generator-karma does not satisfy its siblings peerDependencies requirements](http://stackoverflow.com/questions/19455019/npm-err-peerinvalid-the-package-generator-karma-does-not-satisfy-its-siblings-p) – Paul Sweatte Apr 30 '14 at 14:54

0 Answers0