Error: no such file or directory /_karma_webpack_/...
See original GitHub issueI am using script
// src/test-index.js
const context = require.context('./src', true, /-test\.js$/)
context.keys().forEach(context)
And I keep running into error
> NODE_ENV=test karma start --single-run --no-auto-watch
...
ERROR [karma]: { Error: no such file or directory
at MemoryFileSystem.readFileSync (PROJECT_ROOT/node_modules/memory-fs/lib/MemoryFileSystem.js:107:10)
at MemoryFileSystem.readFile (PROJECT_ROOT/node_modules/memory-fs/lib/MemoryFileSystem.js:297:21)
at doRead (PROJECT_ROOT/node_modules/karma-webpack/index.js:156:26)
at Plugin.readFile (PROJECT_ROOT/node_modules/karma-webpack/index.js:160:3)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
code: 'ENOENT',
errno: 34,
message: 'no such file or directory',
path: '/_karma_webpack_/test-index.js' }
Error: no such file or directory
at MemoryFileSystem.readFileSync (PROJECT_ROOT/node_modules/memory-fs/lib/MemoryFileSystem.js:107:10)
at MemoryFileSystem.readFile (PROJECT_ROOT/node_modules/memory-fs/lib/MemoryFileSystem.js:297:21)
at doRead (PROJECT_ROOT/node_modules/karma-webpack/index.js:156:26)
at Plugin.readFile (PROJECT_ROOT/node_modules/karma-webpack/index.js:160:3)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
Here is link to gist with my karma.conf.js and webpack.config.js. I’ve left other files out since these (plus the test-index.js above) are the only files involved in current process.
Node v6.2.0, npm v3.8.9 (installed via nvm). All dependencies were installed in last few hours so I am using latest versions.
Any ideas about what could be wrong or what else could I try?
Link to Stack Overflow question, if you know how to solve this and want some reputation as reward 😄
Issue Analytics
- State:
- Created 7 years ago
- Comments:7
Top Results From Across the Web
Error: no such file or directory /_karma_webpack_/. · Issue #230
Current behavior: Any plugin trying to write to assets folder will fail because karma webpack rewrites webpackOptions.output like so.
Read more >Karma webpack Error: no such file or directory ...
The issue was with trying to reuse my original config for karma webpack config key. I've solved the issue by changing karma config...
Read more >Unit Testing - Error: no such file or directory - Karma/Jasmine
Hello,. I want to start with testing VueJS components that I wrote, but I have some issues with configuration. We are using Gulp,...
Read more >karma-runner/karma - Gitter
I'm running karma start and I get the following error : You need to include some adapter that ... npm WARN ENOENT ENOENT:...
Read more >Installation | webpack
Whether to use --save-dev or not depends on your use cases. Say you're using webpack only for bundling, then it's suggested that you...
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

@markogresak Thank you for your answer. I got the problem. It is all about permissions! I’ve started Karma as
rootusing the following command:The issue was with trying to reuse my original config for karma
webpackconfig key.I’ve solved the issue by changing karma config to:
What’s important here is
moduleobject andnodeobject (to prevent Cannot find module “fs” errors). Theexternalspart is specific to enzyme and is was copied from their Enzyme + Karma + Webpack guide. Also specific to how enzyme is working, note that there is no explicitresolvedeclaration since webpack automatically adds'.js'and'.json', since enzyme is internally requiring both files. An alternative would be to explicitly declare json loader.