执行karma start karma.conf.js
:
> throw error('No provider for "' + name + '"!');
> ^ Error: No provider for "framework:requirejs"! (Resolving: framework:requirejs)
我在全球范围内安装了karma-cli,并在本地安装了karma和jasmine。
这是我的package.json:
"dependencies": {
"bower": "^1.4.1"
, "gulp": "^3.9.0"
, "gulp-gjslint": "^0.1.4"
, "gulp-jshint": "^1.11.0"
, "gulp-jslint": "^0.2.2"
, "gulp-webserver": "^0.9.1"
}
, "devDependencies": {
"karma": "^1.3.0"
, "karma-cli": "^1.0.1"
, "karma-requirejs": "^1.1.0"
, "jasmine": "^2.5.2"
, "jasmine-core": "^2.5.2"
, "karma-jasmine": "^1.0.2"
, "karma-chrome-launcher": "^2.0.0"
, "requirejs": "^2.3.2"
}
karma.conf.js有:
/*global module*/
module.exports = function (config) {
'use strict';
config.set({
basePath: '',
frameworks: ['requirejs', 'jasmine'],
files: ['app/lib/angular/angular.js'
, 'app/lib/angular-mocks/angular-mocks.js'
, 'app/js/main.js'
, 'app/test/testMain.js'],
exclude: [],
preprocessors: {},
reporters: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_DISABLE,
autoWatch: false,
browsers: ['Chrome'],
singleRun: true
});
};
我试图在全球范围内安装业力,这也没有运行。
答案 0 :(得分:0)
我已经解决了删除node_modules文件夹的问题,并按照接下来的步骤(在dev依赖项中安装软件包)解决了这个问题:
rm -rf node_modules/
npm install --save-dev karma
npm install --save-dev karma-cli
npm install --save-dev jasmine
npm install --save-dev jasmine-core
npm install --save-dev karma-jasmine
npm install --save-dev karma-chrome-launcher
npm install --save-dev requirejs
npm install --save-dev karma-requirejs