karma-webpack: ERROR in Entry module not found: Error: Cannot resolve 'file' or 'directory'

When using 1.4.0 I get the error above, <1.4.0 works great. complaint is ./spec/index.js, I assume files is the culprit, not preprocessors:

files: [
    './spec/index.js'
],

or

preprocessors: {
    './spec/index.js': ['webpack']
},

Coincidentally, I see the new webpack-karma reporter is spec, however I can’t imagine that causing a clash.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 2
  • Comments: 33 (4 by maintainers)

Most upvoted comments

@Keats post on Stackoverflow has a good solution.

set the extensions property on Webpack resolve configuration like this:

webpackConfig.resolve.extensions = [‘’, ‘.js’, ‘.coffee’] //ts, or anything else

That solved it for me.

I think Webpack’s error are really unfriendly… I tried for half an hour but failed to found out what’s wrong when it gives this error.

My problem was not changing the resolve.extensions option to include .jsx files. I’ve added it to the end of my webpack.config.js file and it worked:

    // other configs...
    resolve: {
        extensions: [ '', '.js', '.jsx' ]
    }
};

HOLY S#!T the issue for me was that I had an extra comma in my package.json file. Why is THAT hidden behind the --display-error-details flag?

I was getting this error because my resolve.extensions extensions were missing dots. “jsx” should be “.jsx”, for example.

@eryue0220 What is the error you’re receiving?

entry is expecting a string (or array of strings). Assuming entryFile.js is in the same directory as your webpack.config.js, it should read:

module.exports = {
    entry: './entryFile.js',
    output: {
        filename: 'outputFile.js'
    }
}

Yeah for me “–display-error-details” was a big help and then it turned out that some directory of mine was capitalized whereas my import scripts sources were not.

Also git was not seeing those changes locally so I ended up having to run this from my terminal to be able to commit the directory changes git config core.ignorecase false

I have the same problem.