codymikol / karma-webpack

Karma webpack Middleware
MIT License
830 stars 222 forks source link

Possible missing dependency on babel-runtime #307

Closed christopherthielen closed 6 years ago

christopherthielen commented 6 years ago

I'm submitting a bug report

Webpack version: 3.11.0

Webpack Karma version: 1.7.x

Karma version: 2.0.11

Please tell us about your environment: OSX

Current behavior:

$ karma start
25 02 2018 19:56:08.367:ERROR [config]: Error in config file!
 { Error: Cannot find module 'babel-runtime/helpers/toConsumableArray'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/cthielen/projects/uirouter/sticky-states/node_modules/karma-webpack/lib/karma-webpack.js:3:27)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/cthielen/projects/uirouter/sticky-states/node_modules/karma-webpack/lib/index.js:7:18)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32) code: 'MODULE_NOT_FOUND' }
git clone https://github.com/ui-router/sticky-states.git
cd sticky-states
git checkout karma-webpack
yarn
yarn add --dev karma-webpack@2.0.11
yarn test

Adding babel-runtime as a dep fixes the issue. Guessing this was due to https://github.com/webpack-contrib/karma-webpack/commit/6d28c5cf1246e1659a7553c18af6f43de84a7db5. 2.0.9 was the last version of karma-webpack that worked without babel-runtime.

dmk1111 commented 6 years ago

We had to lock version to 2.0.9 as this breaking change was not announced properly

michael-ciniawsky commented 6 years ago

Could someone please quick review (#310) ?

michael-ciniawsky commented 6 years ago

Released in v2.0.12 🎉

CaseyPeters commented 6 years ago

@michael-ciniawsky This is still failing for me in v2.0.12

peters@peters $ npm install
karma-webpack@2.0.12 node_modules/karma-webpack
├── source-map@0.5.7
├── loader-utils@1.1.0 (big.js@3.2.0, emojis-list@2.1.0, json5@0.5.1)
├── async@2.6.0
├── webpack-dev-middleware@1.12.2 (time-stamp@2.0.0, path-is-absolute@1.0.1, range-parser@1.2.0, mime@1.6.0, memory-fs@0.4.1)
└── lodash@4.17.5
peters@peters $ npm run ci:angular-unit-tests

> campspot@1.0.0 ci:angular-unit-tests /Users/peters/IdeaProjects/campspot
> node --max_old_space_size=4096 $(npm bin)/karma start karma.ci.conf.js

26 02 2018 16:51:04.972:ERROR [plugin]: Error during loading "karma-webpack" plugin:
  Cannot find module 'babel-runtime/helpers/toConsumableArray'
26 02 2018 16:51:05.066:ERROR [preprocess]: Can not load "webpack", it is not registered!
  Perhaps you are missing some plugin?

START:
26 02 2018 16:51:05.229:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9876/
26 02 2018 16:51:05.230:INFO [launcher]: Launching browser ChromeCustom with unlimited concurrency
26 02 2018 16:51:05.231:ERROR [karma]: Found 2 load errors

npm ERR! Darwin 17.4.0
npm ERR! argv "/Users/peters/.nvm/versions/node/v4.2.2/bin/node" "/Users/peters/.nvm/versions/node/v4.2.2/bin/npm" "run" "ci:angular-unit-tests"
npm ERR! node v4.2.2
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! campspot@1.0.0 ci:angular-unit-tests: `node --max_old_space_size=4096 $(npm bin)/karma start karma.ci.conf.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the campspot@1.0.0 ci:angular-unit-tests script 'node --max_old_space_size=4096 $(npm bin)/karma start karma.ci.conf.js'.
npm ERR! This is most likely a problem with the campspot package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node --max_old_space_size=4096 $(npm bin)/karma start karma.ci.conf.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls campspot
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/peters/IdeaProjects/campspot/npm-debug.log
michael-ciniawsky commented 6 years ago

😞 Could include some context ({Error} Logs,package.json etc), did you clean the npm/yarn cache and updated the lockfile etc ?

CaseyPeters commented 6 years ago

@michael-ciniawsky updated my previous comment with out console output. We are using it as a dev-dependency so it will not be included in our lockfile. I did clear the npm cache

arturs-razmuss commented 6 years ago

On project with webpack@3.7.1 karma@1.7.1 karma-webpack@2.0.12 the following error is encountered.

ERROR [plugin]: Error during loading "C:\project\node_modules/karma-webpack" plugin:
  Cannot find module 'babel-runtime/helpers/toConsumableArray'
ERROR [preprocess]: Can not load "webpack", it is not registered!

This seems to be caused by the fact project doesn't use babel and babel-runtime is not provided as dependency by karma-webpack. Thus require call fails on _\nodemodules\karma-webpack\lib\karma-webpack.js:3

var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
benedikt-roth commented 6 years ago

Not sure why there is no notice, but just FYI: this was fixed in #312. Note: could well be that it's gonna be reverted 😃