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

Karma cant find the npm modules #1488

Closed
roine opened this Issue Jul 10, 2015 · 10 comments

Comments

Projects
None yet
6 participants
@roine

roine commented Jul 10, 2015

Node version: v0.12.7
NPM version: 2.13.0

For some reason karma cannot find some modules. Note: I'm also requesting karma-mocha and this doesnt throw a warning.

jon % karma start
WARN [plugin]: Cannot find plugin "karma-chai".
  Did you forget to install it ?
  npm install karma-chai --save-dev
WARN [plugin]: Cannot find plugin "karma-jspm".
  Did you forget to install it ?
  npm install karma-jspm --save-dev

/Users/jon/.npm-packages/lib/node_modules/karma/node_modules/di/lib/injector.js:9
      throw error('No provider for "' + name + '"!');
            ^
Error: No provider for "framework:chai"! (Resolving: framework:chai)
    at error (/Users/jon/.npm-packages/lib/node_modules/karma/node_modules/di/lib/injector.js:22:68)
    at Object.parent.get (/Users/jon/.npm-packages/lib/node_modules/karma/node_modules/di/lib/injector.js:9:13)
    at get (/Users/jon/.npm-packages/lib/node_modules/karma/node_modules/di/lib/injector.js:54:19)
    at /Users/jon/.npm-packages/lib/node_modules/karma/lib/server.js:29:14
    at Array.forEach (native)
    at start (/Users/jon/.npm-packages/lib/node_modules/karma/lib/server.js:28:21)
    at invoke (/Users/jon/.npm-packages/lib/node_modules/karma/node_modules/di/lib/injector.js:75:15)
    at Object.exports.start (/Users/jon/.npm-packages/lib/node_modules/karma/lib/server.js:307:12)
    at Object.exports.run (/Users/jon/.npm-packages/lib/node_modules/karma/lib/cli.js:220:27)
    at Object.<anonymous> (/Users/jon/.npm-packages/lib/node_modules/karma/bin/karma:3:23)

But the plugin is installed

jon % npm list karma-jspm
reportum_data_analysis_ui@0.0.1 /Users/jon/projects/test
└── karma-jspm@2.0.0-beta.1

My package.json

{
  "name": "reportum_data_analysis_ui",
  "version": "0.0.1",
  "description": "The Reportum Clinical Dashboard",
  "scripts": {},
  "author": "",
  "license": "ISC",
  "jspm": {
    "directories": {},
    "dependencies": {
      "bootcards": "bower:bootcards@^1.1.2",
      "classnames": "npm:classnames@^2.1.2",
      "fetch": "github:github/fetch@^0.9.0",
      "ramda": "npm:ramda@^0.15.1",
      "react": "npm:react@^0.14.0-alpha3",
      "react-google-charts": "npm:react-google-charts@^0.1.4"
    },
    "devDependencies": {
      "babel": "npm:babel-core@^5.1.13",
      "babel-runtime": "npm:babel-runtime@^5.1.13",
      "core-js": "npm:core-js@^0.9.4"
    }
  },
  "devDependencies": {
    "babel-eslint": "^3.1.20",
    "babel-jest": "^5.3.0",
    "chai": "^3.0.0",
    "classnames": "^2.1.3",
    "cssnext": "^1.8.0",
    "eslint": "^0.24.0",
    "eslint-plugin-react": "^2.6.3",
    "http-server": "^0.8.0",
    "jest": "^0.1.40",
    "karma": "^0.12.37",
    "karma-babel-preprocessor": "^5.2.1",
    "karma-chai": "^0.1.0",
    "karma-jspm": "^2.0.0-beta.1",
    "karma-mocha": "^0.2.0",
    "karma-sinon": "^1.0.4",
    "mocha": "^2.2.5",
    "onchange": "^1.1.0",
    "parallelshell": "latest",
    "postcss": "^4.1.13",
    "postcss-cli": "^1.3.1",
    "postcss-nested": "^0.3.2",
    "react": "^0.13.3",
    "sinon": "^1.15.4"
  },
  "dependencies": {
  }
}

My karma conf file

// Karma configuration
// Generated on Fri Jul 10 2015 08:21:56 GMT+0100 (BST)

module.exports = function (config) {
  config.set({

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '.',

    plugins: ['karma-mocha', 'karma-chai', 'karma-jspm'],


    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['mocha', 'chai', 'jspm'],



    // list of files / patterns to load in the browser
    files: [],

    jspm: {
      loadFiles: ['source/**/*.spec.js']
    },


    // list of files to exclude
    exclude: [],


    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {},


    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],


    // web server port
    port: 9876,


    // enable / disable colors in the output (reporters and logs)
    colors: true,


    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,


    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,


    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['PhantomJS'],


    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: true
  })
}
@dignifiedquire

This comment has been minimized.

Show comment
Hide comment
@dignifiedquire

dignifiedquire Jul 10, 2015

Member

What binary are you using? Do you have karma or karma-cli installed globaly?

Member

dignifiedquire commented Jul 10, 2015

What binary are you using? Do you have karma or karma-cli installed globaly?

@roine

This comment has been minimized.

Show comment
Hide comment
@roine

roine Jul 10, 2015

I'm using the globally installed karma.

roine commented Jul 10, 2015

I'm using the globally installed karma.

@dignifiedquire

This comment has been minimized.

Show comment
Hide comment
@dignifiedquire

dignifiedquire Jul 10, 2015

Member

That's the problem then, you should use karma-cli globally, http://karma-runner.github.io/0.12/intro/installation.html
If you install karma globally it doesn't use the local installation.

Member

dignifiedquire commented Jul 10, 2015

That's the problem then, you should use karma-cli globally, http://karma-runner.github.io/0.12/intro/installation.html
If you install karma globally it doesn't use the local installation.

@roine

This comment has been minimized.

Show comment
Hide comment
@roine

roine Jul 10, 2015

npm i -g karma-cli did the trick thank you @dignifiedquire

roine commented Jul 10, 2015

npm i -g karma-cli did the trick thank you @dignifiedquire

@VaJoy

This comment has been minimized.

Show comment
Hide comment
@VaJoy

VaJoy Oct 30, 2015

thx a lot, I got the same problem also~

VaJoy commented Oct 30, 2015

thx a lot, I got the same problem also~

@enapupe

This comment has been minimized.

Show comment
Hide comment
@enapupe

enapupe Nov 9, 2015

Starting karma from ./node_modules/karma/bin/karma start karma.conf.js worked just fine for me. No need to intall such CLI globally. Where node_modules is the project local node_modules folder

enapupe commented Nov 9, 2015

Starting karma from ./node_modules/karma/bin/karma start karma.conf.js worked just fine for me. No need to intall such CLI globally. Where node_modules is the project local node_modules folder

@houssemFat

This comment has been minimized.

Show comment
Hide comment
@houssemFat

houssemFat Dec 7, 2015

Getting same problem on node 4.2, with karma as global, Cannot find plugin "karma-jasmine".

but worked using local installed lib (on windows ) node node_modules\karma\bin\karma start karma.conf.js

houssemFat commented Dec 7, 2015

Getting same problem on node 4.2, with karma as global, Cannot find plugin "karma-jasmine".

but worked using local installed lib (on windows ) node node_modules\karma\bin\karma start karma.conf.js

@dignifiedquire

This comment has been minimized.

Show comment
Hide comment
@dignifiedquire

dignifiedquire Dec 7, 2015

Member

karma should NOT be installed globally, it will not work! Install karma-cli if you want a global cmd and install karma + plugins locally

Member

dignifiedquire commented Dec 7, 2015

karma should NOT be installed globally, it will not work! Install karma-cli if you want a global cmd and install karma + plugins locally

@houssemFat

This comment has been minimized.

Show comment
Hide comment
@houssemFat

houssemFat commented Dec 7, 2015

+1 thanks @dignifiedquire .

@ORESoftware

This comment has been minimized.

Show comment
Hide comment
@ORESoftware

ORESoftware Aug 12, 2017

So to be specific:

npm install -g karm-cli
npm install -D karma

is that right? seems weird that the karma executable would interfere with the karma-cli executable if you installed both globally...

ORESoftware commented Aug 12, 2017

So to be specific:

npm install -g karm-cli
npm install -D karma

is that right? seems weird that the karma executable would interfere with the karma-cli executable if you installed both globally...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment