Karma can't load webpack

纵然是瞬间 提交于 2019-12-05 07:54:37

Something has changed in the latest versions of karma-* projects. I have got the same issue as I installed everything latest. Now I tried exactly the versions here and it worked out.

I had a similar error but the post referenced in the accepted solution did not work for me. If you're looking for alternatives, read below!


I was seeing the following error message:

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)

I found this solution on a Github issue:

https://github.com/webpack/karma-webpack/issues/65

Here is are the updated lines in my package.json:

"karma": "^0.13.3",
"karma-chrome-launcher": "^0.2.0",
"karma-jasmine": "^0.3.6",
"karma-webpack": "^1.7.0",

Hope this helps.

You should upgrade "karma" and "karma-webpack" packages. Had similar exception, upgrading to next versions solved this:

"karma": "0.13.18",
"karma-webpack": "1.7.0"
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!