Javascript 因果报应可以';无法加载网页包
我得到了这个错误Javascript 因果报应可以';无法加载网页包,javascript,karma-runner,webpack,karma-mocha,Javascript,Karma Runner,Webpack,Karma Mocha,我得到了这个错误 16 07 2015 13:03:52.741:WARN [preprocess]: Can not load "webpack"! Error: Can not resolve circular dependency! (Resolving: preprocessor:webpack -> webpackPlugin -> preprocessor:webpack) 我的karma.conf看起来像 var webpack = require('webpa
16 07 2015 13:03:52.741:WARN [preprocess]: Can not load "webpack"!
Error: Can not resolve circular dependency! (Resolving: preprocessor:webpack -> webpackPlugin -> preprocessor:webpack)
我的karma.conf看起来像
var webpack = require('webpack');
module.exports = function (config) {
config.set({
browsers: [ 'Chrome' ], //run in Chrome
singleRun: true, //just run once by default
frameworks: [ 'mocha' ], //use the mocha test framework
files: [
'tests.webpack.js' //just load this file
],
preprocessors: {
'tests.webpack.js': [ 'webpack', 'sourcemap' ] //preprocess with webpack and our sourcemap loader
},
reporters: [ 'dots' ], //report results in this format
webpack: { //kind of a copy of your webpack config
devtool: 'inline-source-map', //just do inline source maps instead of the default
module: {
loaders: [
{ test: /\.js$/, loader: 'babel-loader' }
]
}
},
webpackServer: {
noInfo: true //please don't spam the console when running in karma!
}
});
};
和tests.webpack.js
var context = require.context('./src', true, /-test\.js$/); //make sure you have your directory and regex test set correctly!
context.keys().forEach(context);
我确实安装了karma和karma网页包
有什么想法吗 最新版本的karma-*项目发生了一些变化。我安装了所有最新的软件,但遇到了同样的问题。现在我完全尝试了这些版本,结果成功了。我有一个类似的错误,但在接受的解决方案中引用的帖子对我不起作用。如果你正在寻找替代品,请阅读下面的内容
我看到以下错误消息:
WARN [preprocess]: Can not load "webpack"!
TypeError: Object [object Object] has no method 'refreshFiles'
at Plugin.notifyKarmaAboutChanges (/Users/abhandaru/workspace/source/macaw-campaigns/node_modules/karma-webpack/index.js:108:15)
at Plugin.<anonymous> (/Users/abhandaru/workspace/source/macaw-campaigns/node_modules/karma-webpack/index.js:72:9)
at Tapable.applyPlugins (/Users/abhandaru/workspace/source/macaw-campaigns/node_modules/webpack/node_modules/tapable/lib/Tapable.js:26:37)
希望这有帮助。您应该升级“karma”和“karma webpack”软件包。如果出现类似的异常,升级到下一版本解决了此问题:
"karma": "0.13.18",
"karma-webpack": "1.7.0"
为什么你的karma.conf中有你的网页<代码>var webpack=require('webpack')代码>
"karma": "0.13.18",
"karma-webpack": "1.7.0"