5

Hi I am following this tutorial of angular , but by running the following command, test.bat. I get this error and not very well may be due.

"Can not load script, it is not registered! Perhaps you are missing some plugin"

I followed all the steps of this tutorial, I think I miss the pluggins. I have a folder in the root of the application called node_modules, where are all these pluggins

     karma
     karma-chrome-launcher
     karma-coffee-preprocessor
     karma-firefox-launcher
     karma-html2js-preprocessor
     karma-jasmine
     karma-junit-reporter
     karma-phantomjs-launcher
     karma-RequireJS
     karma-script-launcher

My karma.config

module.exports = function(config){

config.set({
basePath : '../',

files : [
  'app/lib/angular/angular.js',
  'app/lib/angular/angular-*.js',
  'test/lib/angular/angular-mocks.js',
  'app/js/**/*.js',
  'test/unit/**/*.js'
],

exclude: ['app/lib/angular/angular-scenario.js'],

autoWatch : true,

frameworks: ['jasmine'],

browsers : ['C:/Program Files/Google/Chrome/Application/chrome.exe'],

plugins : [
  'karma-junit-reporter',
  'karma-chrome-launcher',
  'karma-firefox-launcher',
  'karma-jasmine'
],

junitReporter : {
  outputFile: 'test_out/unit.xml',
  suite: 'unit'
}

})}

Anyone can help me?

thanks

1 Answer 1

6

You need to add the missing plugin to the karma config plugins section:

plugins : [
  'karma-junit-reporter',
  'karma-chrome-launcher',
  'karma-firefox-launcher',
  'karma-jasmine'
],

Or simply remove this plugin section and karma will load all plugins it finds. (It's ok to do this if you don't have too many plugins)

Edit:

Just cloned and installed the test project. Here are the installed dependencies:

karma                      
karma-html2js-preprocessor  
karma-phantomjs-launcher
karma-chrome-launcher      
karma-jasmine               
karma-requirejs
karma-coffee-preprocessor  
karma-junit-reporter        
karma-script-launcher
karma-firefox-launcher     
karma-ng-scenario           
phantomjs

It looks to me that you dont have phantomjs installed.

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks bekite, my karma pluggins are installed in C:\Users\XXX\AppData\Roaming\npm\node_modules it is correct? I install karma with this command npm install -g karma. I dont run it!!!
Inside your angular-phonecat folder you have a node_modules folder. You don't need to run the karma command. The test.bat script does this for you.
I dont have the node_modules folder. karma dont find the plugins. If I remove the pluggin section of the configuration file, and i run, launch 3 instances of chrome, but do not run the unit test
Thanks! It worked! You do not need the node-pluggins folder in the root of the application. I had a problem with the chrome configuration browser that had set to the full path of the exe, I changed that, and I added the key CHROME_BIN in environment variables and run fine. Thans a lot bekite
I npm installed all of these and all my errors are now gone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.