xdissent / karma-chai

Chai for Karma
http://xdissent.github.io/karma-chai
MIT License
60 stars 66 forks source link

Error: Cannot find module 'chai' #17

Open miparnisari opened 7 years ago

miparnisari commented 7 years ago

I followed the installation steps and this is my karma.conf.js:

module.exports = function (config) {
  config.set({
    basePath: process.cwd(),
    frameworks: ['mocha', 'chai'],
    files: [
      'bower_components/angular/angular.js',
      'bower_components/angular-mocks/angular-mocks.js',
      'bower_components/angular-resource/angular-resource.js',
      // shortened for brevity
      { pattern: 'app/**/*.js', included: true, nocache: true, watched: false },
      { pattern: 'test/spec/**/*.js', included: true, nocache: true, watched: false }],
    exclude: [],
    preprocessors: {},
    port: 9876,
    colors: true,
    logLevel: config.LOG_DEBUG,
    autoWatch: false,
    browsers: ['Chrome'],
    singleRun: true,
    concurrency: Infinity
  });
};

When I run karma I get this:

λ gulp test                                                                                
[12:30:29] Using gulpfile ~\Desktop\project\frontend\gulpfile.js                            
[12:30:29] Starting 'start:server:test'...                                                 
[12:30:29] Finished 'start:server:test' after 149 ms                                       
[12:30:29] Starting 'test'...                                                              
21 12 2016 12:30:29.294:DEBUG [plugin]: Loading karma-* from C:\Users\miparnisari\project\frontend\node_modules                                                                
21 12 2016 12:30:29.294:DEBUG [plugin]: Loading plugin C:\Users\miparnisari\Desktop\project\
frontend\node_modules/karma-chai.                                                          
21 12 2016 12:30:29.294:DEBUG [plugin]: Loading plugin C:\Users\miparnisari\Desktop\project\
frontend\node_modules/karma-chrome-launcher.                                               
21 12 2016 12:30:29.294:DEBUG [plugin]: Loading plugin C:\Users\miparnisari\Desktop\project\
frontend\node_modules/karma-mocha.                                                         
21 12 2016 12:30:29.310:DEBUG [plugin]: Loading plugin C:\Users\miparnisari\Desktop\project\
frontend\node_modules/karma-phantomjs-launcher.                                            
21 12 2016 12:30:29.310:DEBUG [plugin]: Loading plugin C:\Users\miparnisari\Desktop\project\
frontend\node_modules/karma-requirejs.                                                     
[12:30:29] 'test' errored after 48 ms                                                      
[12:30:29] Error: Cannot find module 'chai'                                                
    at Function.Module._resolveFilename (module.js:325:15)                                 
    at Function.require.resolve (internal/module.js:16:19)                                 
blabno commented 7 years ago

Your npm did not install chai.

npm i -DE chai
luckylooke commented 5 years ago

@blabno I would expect this step to be mentioned in https://github.com/xdissent/karma-chai#installation, thanks