karma icon indicating copy to clipboard operation
karma copied to clipboard

Can not load "webpack"

Open kof opened this issue 11 years ago • 15 comments

https://stackoverflow.com/questions/31444743/karma-cant-load-webpack/31452564

Its reproducible when you install all the latest versions of karma-* on node v2.3.4

kof avatar Jul 16 '15 11:07 kof

react-bootstrap/react-bootstrap same issue.

AlexKVal avatar Jul 16 '15 12:07 AlexKVal

Thanks for the report, I will look into it as soon as I can

dignifiedquire avatar Jul 16 '15 12:07 dignifiedquire

Can you please check if this is still an issue in 0.13.1

dignifiedquire avatar Jul 16 '15 19:07 dignifiedquire

@Dignifiedquire yep, still seeing it with v0.13.1

mateatslc avatar Jul 16 '15 19:07 mateatslc

I'm also still having the same issue. My project tried to closely follow this example project.

$ <node_modules/karma/package.json | grep version
  "version": "0.13.1",
$ karma start
16 07 2015 22:43:10.756:WARN [preprocess]: Can not load "webpack"!
  Error: Can not resolve circular dependency! (Resolving: preprocessor:webpack -> webpackPlugin -> preprocessor:webpack)
    at error (/Volumes/code/experiments/modern-react/node_modules/karma/node_modules/di/lib/injector.js:22:68)
    at get (/Volumes/code/experiments/modern-react/node_modules/karma/node_modules/di/lib/injector.js:44:15)
    at instantiatePreprocessor (/Volumes/code/experiments/modern-react/node_modules/karma/lib/preprocessor.js:56:37)
    at Array.forEach (native)
    at null.<anonymous> (/Volumes/code/experiments/modern-react/node_modules/karma/lib/preprocessor.js:77:31)
    at tryCatcher (/Volumes/code/experiments/modern-react/node_modules/bluebird/js/main/util.js:26:23)
    at ret [as _preprocess] (eval at <anonymous> (/Volumes/code/experiments/modern-react/node_modules/bluebird/js/main/promisify.js:163:12), <anonymous>:13:39)
    at /Volumes/code/experiments/modern-react/node_modules/karma/lib/file-list.js:183:19
    at Array.map (native)
    at /Volumes/code/experiments/modern-react/node_modules/karma/lib/file-list.js:168:30
    at Array.map (native)
    at List._refresh (/Volumes/code/experiments/modern-react/node_modules/karma/lib/file-list.js:151:37)
    at List.refresh (/Volumes/code/experiments/modern-react/node_modules/karma/lib/file-list.js:250:27)
    at Plugin.notifyKarmaAboutChanges (/Volumes/code/experiments/modern-react/node_modules/karma-webpack/index.js:109:16)
    at Plugin.<anonymous> (/Volumes/code/experiments/modern-react/node_modules/karma-webpack/index.js:73:9)
    at Tapable.applyPlugins (/Volumes/code/experiments/modern-react/node_modules/webpack/node_modules/tapable/lib/Tapable.js:26:37)
16 07 2015 22:43:19.039:INFO [karma]: Karma v0.13.1 server started at http://localhost:9876/
16 07 2015 22:43:19.050:INFO [launcher]: Starting browser Chrome
16 07 2015 22:43:20.323:INFO [Chrome 43.0.2357 (Mac OS X 10.10.4)]: Connected on socket hShBX6sNlGjwOg1oAAAA with id 8720101
.
Chrome 43.0.2357 (Mac OS X 10.10.4): Executed 1 of 1 SUCCESS (0.046 secs / 0.032 secs)

My package.json relevant deps:

    "karma": "^0.13.1",
    "karma-chrome-launcher": "^0.2.0",
    "karma-cli": "^0.1.0",
    "karma-mocha": "^0.2.0",
    "karma-sourcemap-loader": "^0.3.5",
    "karma-webpack": "^1.6.0",
    "mocha": "^2.2.5",
    "webpack": "^1.10.1",

erkiesken avatar Jul 16 '15 19:07 erkiesken

same here :(

Node v0.12.7

Same Example tried.

Stacktrace:
16 07 2015 22:22:06.617:WARN [preprocess]: Can not load "webpack"!
  Error: Can not resolve circular dependency! (Resolving: preprocessor:webpack -> webpackPlugin -> preprocessor:webpack)
    at error (C:\Users\Christoph\AppData\Roaming\npm\node_modules\karma\node_modules\di\lib\injector.js:22:68)
    at get (C:\Users\Christoph\AppData\Roaming\npm\node_modules\karma\node_modules\di\lib\injector.js:44:15)
    at instantiatePreprocessor (C:\Users\Christoph\AppData\Roaming\npm\node_modules\karma\lib\preprocessor.js:56:37)
    at Array.forEach (native)
    at null.<anonymous> (C:\Users\Christoph\AppData\Roaming\npm\node_modules\karma\lib\preprocessor.js:77:31)
    at tryCatcher (C:\Users\Christoph\AppData\Roaming\npm\node_modules\karma\node_modules\bluebird\js\main\util.js:26:23)
    at ret [as _preprocess] (eval at <anonymous> (C:\Users\Christoph\AppData\Roaming\npm\node_modules\karma\node_modules\bluebird\js\main\promisify.js:163:12), <anonymous>:13:39)
    at C:\Users\Christoph\AppData\Roaming\npm\node_modules\karma\lib\file-list.js:183:19
    at Array.map (native)
    at C:\Users\Christoph\AppData\Roaming\npm\node_modules\karma\lib\file-list.js:168:30
    at Array.map (native)
    at List._refresh (C:\Users\Christoph\AppData\Roaming\npm\node_modules\karma\lib\file-list.js:151:37)
    at List.refresh (C:\Users\Christoph\AppData\Roaming\npm\node_modules\karma\lib\file-list.js:250:27)
    at Plugin.notifyKarmaAboutChanges (C:\Users\Christoph\AppData\Roaming\npm\node_modules\karma-webpack\index.js:109:16)
    at Plugin.<anonymous> (C:\Users\Christoph\AppData\Roaming\npm\node_modules\karma-webpack\index.js:73:9)
    at Tapable.applyPlugins (C:\Users\Christoph\AppData\Roaming\npm\node_modules\karma-webpack\node_modules\webpack\node_modules\tapable\lib\Tapable.js:26:37)

Uter1007 avatar Jul 16 '15 20:07 Uter1007

To get around this issue downgrading karma. This set up works:

"karma": "^0.12.36",
"karma-chrome-launcher": "^0.2.0",
"karma-html-reporter": "^0.2.6",
"karma-jasmine": "^0.3.6",
"karma-phantomjs-launcher": "^0.2.0",
"karma-webpack": "^1.6.0",

MichalZalecki avatar Jul 17 '15 12:07 MichalZalecki

Another working config:

"karma": "^0.12.36",
"karma-chrome-launcher": "^0.2.0",
"karma-cli": "^0.1.0",
"karma-mocha": "^0.2.0",
"karma-sourcemap-loader": "^0.3.5",
"karma-webpack": "^1.6.0",

tshelburne avatar Jul 17 '15 20:07 tshelburne

Just a quick update, I was able to find out what the underlying issue is: In short dependency injection sucks. Fix coming soon

dignifiedquire avatar Jul 17 '15 20:07 dignifiedquire

Okay I've just released 0.13.2 that will resolve the issue together with this pr: https://github.com/webpack/karma-webpack/issues/63

dignifiedquire avatar Jul 17 '15 21:07 dignifiedquire

now just have to wait till that PR gets merged... ಠ_ಠ

mateatslc avatar Jul 17 '15 22:07 mateatslc

Hooray for OSS! Also, thanks for the quick attention to the problem - pretty awesome turnaround time.

tshelburne avatar Jul 17 '15 22:07 tshelburne

OT: DI sucks because it exposes cyclic dependencies? I'd say that's a win for DI and by avoiding partial/unreliable initialisation ;)

Happy for fix, would be great to get https://github.com/webpack/karma-webpack/pull/63 merged and released =)

@mateatslc:

"karma-webpack": "git+https://github.com/Dignifiedquire/karma-webpack.git#29fb1d801158f29cb0eb784edff69356705a7b74",

haf avatar Jul 19 '15 12:07 haf

@Dignifiedquire closed?

tupy avatar Jul 31 '15 13:07 tupy

yep fixed now

dignifiedquire avatar Jul 31 '15 13:07 dignifiedquire