karma-webpack: cannot load 'webpack'
Errors:
Can not load "webpack"!
TypeError: undefined is not a function
at Plugin.notifyKarmaAboutChanges (/Users/jz/jsfiddles/template/node_modules/karma-webpack/index.js:108:15)
at Plugin.<anonymous> (/Users/jz/jsfiddles/template/node_modules/karma-webpack/index.js:72:9)
at Tapable.applyPlugins (/Users/jz/jsfiddles/template/node_modules/webpack/node_modules/tapable/lib/Tapable.js:26:37)
at Watching._done (/Users/jz/jsfiddles/template/node_modules/webpack/lib/Compiler.js:78:17)
at Watching.<anonymous> (/Users/jz/jsfiddles/template/node_modules/webpack/lib/Compiler.js:61:18)
at Tapable.emitRecords (/Users/jz/jsfiddles/template/node_modules/webpack/lib/Compiler.js:281:37)
at Watching.<anonymous> (/Users/jz/jsfiddles/template/node_modules/webpack/lib/Compiler.js:58:19)
at /Users/jz/jsfiddles/template/node_modules/webpack/lib/Compiler.js:274:11
at Tapable.applyPluginsAsync (/Users/jz/jsfiddles/template/node_modules/webpack/node_modules/tapable/lib/Tapable.js:60:69)
at Tapable.afterEmit (/Users/jz/jsfiddles/template/node_modules/webpack/lib/Compiler.js:271:8)
here is my package.json file
{
"name": "components",
"version": "0.0.1",
"description": "components",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
},
"devDependencies": {
"babel-core": "^5.8.9",
"babel-loader": "^5.3.2",
"css-loader": "^0.15.6",
"jasmine-core": "^2.3.4",
"karma": "^0.12.37",
"karma-chrome-launcher": "^0.2.0",
"karma-jasmine": "^0.3.6",
"karma-sourcemap-loader": "^0.3.5",
"karma-webpack": "^1.6.0",
"less": "^2.5.1",
"less-loader": "^2.2.0",
"lodash": "^3.10.0",
"style-loader": "^0.12.3",
"webpack": "^1.10.5"
}
}
I change karma version to ~0.12.37 and karma-webpack to ~1.6.0,it works;
But when karma-webpack is 1.7.0, it throw errors when I run karma start karma.config.js
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 24
Commits related to this issue
- Fix karma-webpack dependency (breaks build) — committed to marmelab/ng-admin by fzaninotto 9 years ago
- Bumped dependencies versions to mitigate issue webpack/karma-webpack#70 — committed to mr-mig/frontend-library-starter by mr-mig 9 years ago
- Bumped dependencies versions to mitigate issue webpack/karma-webpack#70 — committed to mr-mig/frontend-library-starter by mr-mig 9 years ago
- Bumped dependencies versions to mitigate issue webpack/karma-webpack#70 — committed to mr-mig/originate-frontend-lib by mr-mig 9 years ago
- Upgrading Karma to 0.13 for fixing the cannot-load-webpack problem — committed to trialreach/react-slick by deleted user 9 years ago
wow, this whole time I wasn’t using node_modules/.bin/karma and was instead using the global karma.
Just wanted to say this in case anyone else had the same issue.
@pojka @jingzhou123 I’ve just checked you repo and everything is working fine for me, I ran
Could you check that you are using
karma-cliand notkarmainstalled globally, and make sure the global version which you call withkarmais actually up to date.@joeheyming Good call out. Didn’t even think of that. Completely fixed my issues.