Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot start karma - no provider for jasmine #706

Closed
vanntastic opened this issue Aug 19, 2013 · 9 comments

Comments

Projects
None yet
6 participants
@vanntastic
Copy link

commented Aug 19, 2013

Hey Guys:

I'm having an issue with getting karma running (on a non angularJS project) - I've installed all dependencies with npm and ran the karma init my.conf.js 2 times. When I try and run karma start my.conf.js, here's the output:

/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:9
  throw error('No provider for "' + name + '"!');
        ^
Error: No provider for "framework:jasmine"! (Resolving: framework:jasmine)
    at error (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:22:68)
    at Object.parent.get     (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:9:13)
at get (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:54:19)
at /usr/local/lib/node_modules/karma/lib/server.js:27:14
at Array.forEach (native)
at start (/usr/local/lib/node_modules/karma/lib/server.js:26:21)
at invoke (/usr/local/lib/node_modules/karma/node_modules/di/lib/injector.js:75:15)
at Object.exports.start (/usr/local/lib/node_modules/karma/lib/server.js:178:12)
at Object.<anonymous> (/usr/local/lib/node_modules/karma/bin/karma:19:39)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:275:11)

I have karma-jasmine and karma-phantomjs-launcher in node_modules, is there something else that I'm doing wrong? What else can I check?

Thanks,

  • Vann
@vanntastic

This comment has been minimized.

Copy link
Author

commented Aug 19, 2013

figured it out - I had an old version of node installed, I upgraded and everything seems to work just fine.

@vanntastic vanntastic closed this Aug 19, 2013

@aleclarson

This comment has been minimized.

Copy link

commented Feb 28, 2015

I'm getting this error with Node v0.12.0 and v0.10.36

These are the devDependencies that I used with Node v0.12.0:

    "jasmine": "^2.2.1",
    "karma": "^0.12.31",
    "karma-cli": "0.0.4",
    "karma-jasmine": "^0.3.5"

This is the terminal output:

Warning: Command failed: /bin/sh -c karma start karma.config.js --log-level debug
<rootDir>/node_modules/karma/node_modules/di/lib/injector.js:9
      throw error('No provider for "' + name + '"!');
            ^
Error: No provider for "framework:jasmine"! (Resolving: framework:jasmine)
  at error (<rootDir>/node_modules/karma/node_modules/di/lib/injector.js:22:68)
  at Object.parent.get (<rootDir>/node_modules/karma/node_modules/di/lib/injector.js:9:13)
  at [object Object].get (<rootDir>/node_modules/karma/node_modules/di/lib/injector.js:54:19)
  at <rootDir>/node_modules/karma/lib/server.js:31:14
  at Array.forEach (native)
  at start (<rootDir>/node_modules/karma/lib/server.js:30:21)
  at [object Object].invoke (<rootDir>/node_modules/karma/node_modules/di/lib/injector.js:75:15)
  at Object.exports.start (<rootDir>/node_modules/karma/lib/server.js:314:12)
  at Object.exports.run (<rootDir>/node_modules/karma/lib/cli.js:229:25)
  at requireCliAndRun (/usr/local/lib/node_modules/karma-cli/bin/karma:24:16)
  at /usr/local/lib/node_modules/karma-cli/bin/karma:56:12
  at /usr/local/lib/node_modules/karma-cli/node_modules/resolve/lib/async.js:44:21
  at /usr/local/lib/node_modules/karma-cli/node_modules/resolve/lib/async.js:119:35
  at /usr/local/lib/node_modules/karma-cli/node_modules/resolve/lib/async.js:91:39
  at /usr/local/lib/node_modules/karma-cli/node_modules/resolve/lib/async.js:60:30
  at /usr/local/lib/node_modules/karma-cli/node_modules/resolve/lib/async.js:20:18
  at FSReqWrap.oncomplete (fs.js:99:15)

Does anyone know how I can fix this?

@maksimr

This comment has been minimized.

Copy link
Contributor

commented Feb 28, 2015

@aleclarson can you post your karma.config.js

@aleclarson

This comment has been minimized.

Copy link

commented Feb 28, 2015

@maksimr

// karma.config.js

module.exports = function(config) {
    config.set({
        basePath: "",
        frameworks: ["jasmine"],
        plugins: [require("karma-webpack")],
        files: ["build/**/*.js"],
        exclude: ["node_modules"],
        preprocessors: {
            "build/**/*.js": ["webpack"]
        },
        reporters: ["progress"],
        port: 9876,
        colors: true,
        logLevel: config.LOG_DEBUG,
        autoWatch: true,
        browsers: ["Chrome"],
        singleRun: false
    });
};
@maksimr

This comment has been minimized.

Copy link
Contributor

commented Feb 28, 2015

@aleclarson remove property plugins(then karma will by default load all plugins from node_modules by pattern karma-*) or add to it karma-jasmine.

plugins: [require("karma-webpack"), require('karma-jasmine')],
@aleclarson

This comment has been minimized.

Copy link

commented Feb 28, 2015

@maksimr Oh I get it. Thanks!

@arunkumarg

This comment has been minimized.

Copy link

commented Feb 22, 2016

I faced same error and tried to resolve for couple of hours.

Finally I figured out the issue. Which is "Karma module need to install LOCALLY not Globally" But you can have Karma-cli module can be installed globally.

npm uninstall karma -g
npm install karma 

# Optional
npm uninstall karma-cli
npm install karma-cli -g
@liwonder

This comment has been minimized.

Copy link

commented Oct 25, 2016

@arunkumarg Thanks for your sharing! It really helpful!

@WeijianXu

This comment has been minimized.

Copy link

commented Feb 18, 2017

@arunkumarg Your methods are really helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.