Karma - Chrome失败2次(无法启动)。放弃 [英] Karma - Chrome failed 2 times (cannot start). Giving up
问题描述
我一直在尝试使用karma-chrome-launcher运行我的测试,但每次运行我的测试时都会抛出以下错误:
INFO [启动器]:启动浏览器Chrome
ERROR [启动程序]:无法启动Chrome
INFO [启动程序]:尝试重新启动Chrome 1/2)。
错误[启动程序]:无法启动Chrome
INFO [启动程序]:尝试再次启动Chrome(2/2)。
错误[启动器]:无法启动Chrome
错误[启动器]:Chrome失败2次(无法启动)。放弃。
这是我的karma.conf.js代码:
// Karma configuration
//在2015年3月23日14:04:19 GMT-0300(BRT)生成
module.exports = function(config){
config.set({
//将用于解析所有模式的基本路径(例如文件,排除)
basePath:'www ',
//使用
的框架//可用框架:https://npmjs.org/browse/keyword/karma-adapter
框架:[ 'jasmine'],
//在浏览器中加载的文件/模式列表
文件:[
'lib / ionic / js / angular / angular .js',
'lib / ionic / js / angular / angular-animate.js',
'lib / ionic / js / angular / angular-sanitize.js',
'../node_modules/jasmine-core/lib/jasmine-core/jasmine.js',
'../node_modules/mock-local-storage/lib/mock-localstorage.js',
'../node_modules/angular-mocks/angular-mocks。 js',
//'../node_modules/requirejs/require.js',
'lib / ionic / js / angular / angular-resource.js',
'lib / ionic /js/angular-ui/angular-ui-router.js',
'lib / ionic / js / ionic.js',
'lib / ionic / js / ionic-angular.js',
/*'../tests/libs/ngCordovaMocks.min.js',*/
'js / lib / ng-cordova.min.js',
'js / *。 js',
'js / controllers / *。js',
'js / services / *。js',
'js / factory / *。js',
/ /'../tests/*.js',
'../tests/**/*.js'
],
//列表的文件排除
exclude:[
],
//在将文件提供给浏览器之前预处理匹配文件
//可用预处理器:https ://npmjs.org/browse/keyword/karma-preprocessor
预处理器:{
},
//测试结果记者使用
//可能的值:'dots','progress'
/ /可用记者:https://npmjs.org/browse/keyword/karma-reporter
记者:['progress','html'],
htmlReporter:{
outputFile:'../tests/report/index.html'
},
//网络服务器端口
端口:9876,
插件:[
'karma-junit-reporter',
'karma-jasmine',
'karma-phantomjs-launcher',
'karma-chrome-launcher '
//'karma-htmlfile-reporter'
],
//在输出中启用/禁用颜色(记者和日志)
颜色:true,
//记录等级
//可能的值:config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel:config.LOG_INFO,
//启用/禁用监视文件并在任何文件更改时执行测试
autoWatch:true,
//启动这些浏览器
//可用浏览器启动器:https://npmjs.org/browse/keyword/karma-launcher
浏览器:['PhantomJS'] ,
//持续集成模式
//如果为真,Karma捕获浏览器,运行测试并退出
singleRun:false
});
};
我在这里安装模块: https://www.npmjs.com/package/karma-chrome-launcher
感谢!
我遇到同样的问题,并尝试了很多我找到的建议解决方案,但最终解决了什么问题对我来说,是删除node_modules文件夹,并通过npm install获取所有新的内容
I've been trying to run my tests using karma-chrome-launcher, but everytime I run my tests it throws this error:
INFO [launcher]: Starting browser Chrome ERROR [launcher]: Cannot start Chrome
INFO [launcher]: Trying to start Chrome again (1/2).
ERROR [launcher]: Cannot start Chrome
INFO [launcher]: Trying to start Chrome again (2/2).
ERROR [launcher]: Cannot start Chrome
ERROR [launcher]: Chrome failed 2 times (cannot start). Giving up.
Here's my karma.conf.js code:
// Karma configuration
// Generated on Mon Mar 23 2015 14:04:19 GMT-0300 (BRT)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: 'www',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'lib/ionic/js/angular/angular.js',
'lib/ionic/js/angular/angular-animate.js',
'lib/ionic/js/angular/angular-sanitize.js',
'../node_modules/jasmine-core/lib/jasmine-core/jasmine.js',
'../node_modules/mock-local-storage/lib/mock-localstorage.js',
'../node_modules/angular-mocks/angular-mocks.js',
//'../node_modules/requirejs/require.js',
'lib/ionic/js/angular/angular-resource.js',
'lib/ionic/js/angular-ui/angular-ui-router.js',
'lib/ionic/js/ionic.js',
'lib/ionic/js/ionic-angular.js',
/*'../tests/libs/ngCordovaMocks.min.js',*/
'js/lib/ng-cordova.min.js',
'js/*.js',
'js/controllers/*.js',
'js/services/*.js',
'js/factory/*.js',
//'../tests/*.js',
'../tests/**/*.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', 'html'],
htmlReporter: {
outputFile: '../tests/report/index.html'
},
// web server port
port: 9876,
plugins : [
'karma-junit-reporter',
'karma-jasmine',
'karma-phantomjs-launcher',
'karma-chrome-launcher'
//'karma-htmlfile-reporter'
],
// 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: false
});
};
I'm installing the module here: https://www.npmjs.com/package/karma-chrome-launcher
Thanks!
I had the same problem and tried a lot of the suggested solutions I found, but what finally solved it for me was to delete the node_modules folder and getting everything new via npm install
这篇关于Karma - Chrome失败2次(无法启动)。放弃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!