Can not load 'webpack' - issue with v2.1.0
See original GitHub issueI’m submitting a bug report
Webpack version: “webpack”: “2.2.0-rc.1”
Webpack Karma version: “karma-webpack”: “1.8.0”
Karma version: 0.13.x/1.x
Env OSX 10.x - Chrome Version 55.0.2883.95 (64-bit)
Current behavior: Test runner fails out before getting to run step. Issue says ‘Can not load “webpack”’
Project configuration:
Currently using
"karma": "1.4.0",
"karma-chrome-launcher": "2.0.0",
"karma-coverage": "1.1.1",
"karma-jasmine": "1.1.0",
"karma-mocha-reporter": "2.2.1",
"karma-phantomjs-launcher": "1.0.2",
"karma-remap-coverage": "0.1.4",
"karma-source-map-support": "1.2.0",
"karma-sourcemap-loader": "0.3.7",
"karma-webpack": "2.0.1"
with Webpack version specified above. Failing as follows:
keywords if/then/else require v5 option
18 01 2017 15:11:14.083:ERROR [preprocess]: Can not load "webpack"!
Error
at webpack (/Users/j/Developer/AspNetCoreSpa/node_modules/webpack/lib/webpack.js:17:9)
at new Plugin (/Users/j/Developer/AspNetCoreSpa/node_modules/karma-webpack/lib/karma-webpack.js:65:18)
at invoke (/Users/j/Developer/AspNetCoreSpa/node_modules/di/lib/injector.js:75:15)
at Array.instantiate (/Users/j/Developer/AspNetCoreSpa/node_modules/di/lib/injector.js:59:20)
at get (/Users/j/Developer/AspNetCoreSpa/node_modules/di/lib/injector.js:48:43)
at /Users/j/Developer/AspNetCoreSpa/node_modules/di/lib/injector.js:71:14
at Array.map (native)
at Array.invoke (/Users/j/Developer/AspNetCoreSpa/node_modules/di/lib/injector.js:70:31)
at Injector.get (/Users/j/Developer/AspNetCoreSpa/node_modules/di/lib/injector.js:48:43)
at instantiatePreprocessor (/Users/j/Developer/AspNetCoreSpa/node_modules/karma/lib/preprocessor.js:55:20)
at Array.forEach (native)
at createPreprocessor (/Users/j/Developer/AspNetCoreSpa/node_modules/karma/lib/preprocessor.js:74:20)
at Array.invoke (/Users/j/Developer/AspNetCoreSpa/node_modules/di/lib/injector.js:75:15)
at get (/Users/j/Developer/AspNetCoreSpa/node_modules/di/lib/injector.js:48:43)
at /Users/j/Developer/AspNetCoreSpa/node_modules/di/lib/injector.js:71:14
at Array.map (native)
START:
18 01 2017 15:11:14.154:INFO [karma]: Karma v1.4.0 server started at http://0.0.0.0:9876/
18 01 2017 15:11:14.154:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
18 01 2017 15:11:14.155:ERROR [karma]: Found 1 load error
npm ERR! Darwin 16.3.0
npm ERR! argv "/Users/j/.nvm/versions/node/v7.4.0/bin/node" "/Users/j/.nvm/versions/node/v7.4.0/bin/npm" "run" "test"
npm ERR! node v7.4.0
npm ERR! npm v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! aspnetnetcore@0.0.0 test: `karma start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the aspnetnetcore@0.0.0 test script 'karma start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the aspnetnetcore package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! karma start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs aspnetnetcore
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls aspnetnetcore
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/j/Developer/AspNetCoreSpa/npm-debug.log
Reverted to "karma-webpack": "1.8.0", tests successfully run without warning.
Issue Analytics
- State:
- Created 7 years ago
- Comments:25 (5 by maintainers)
Top Results From Across the Web
Can not load 'webpack' - issue with v2.1.0 #210 - GitHub
I'm submitting a bug report Webpack version: "webpack": "2.2.0-rc.1" Webpack Karma version: "karma-webpack": "1.8.0" Karma version: ...
Read more >Angular 2 npm test - Can not load "webpack" - Stack Overflow
I'm seeing an error when I try to run npm test 08 09 2017 16:50:50.240:ERROR [preprocess]: Can not load "webpack"! TypeError: Cannot read ......
Read more >How I solved and debugged my Webpack issue through trial ...
When webpack bundles your source code, it can become difficult to track down errors and warnings to their original location.
Read more >Production | webpack
In this guide, we'll dive into some of the best practices and utilities for building a production site or application.
Read more >Webpack - npm
Webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@graingert - For webpack
2.2.0-rc.4and beyond, config schema is strictly enforced and will error if it’s missing something required.As part of the schema enforcement, in you webpack configuration you can’t pass
webpackConfig.entryand empty object. Historically this has been a common practice in many test configs.You can on the other hand pass
webpackConfig.entrya function. So in the case where people were usingentry: {}they simply need to remove it. For those that don’t need / have an entry target in their config, removing it allows karma-webpack to use it’s default which under the hood assigns a function that returnsentry: {}towebpackConfig.entry.@graingert - I’ve updated the release notes: https://github.com/webpack/karma-webpack/releases/tag/v2.0.0
I’ll get the same in the change log shortly