I had installed it globally by running npm install webpack -g and I had included it in my project by running npm install webpack --save-dev.
However, on running the
Common mistakes of this error is typo and most of the times it's writing
module.export
instead of module.exports
.
Also check the file name should be with a .js extension. e.g. webpack.config.js
Assuming that you would be using windows. i ran out into same error and realized i have to do something like this in wiindows d:\unpack-webpack> d:\unpack-webpack\node_modules.bin\webpack
instead i was doing d:\unpack-webpack\node_modules.bin\webpack
Hope this helps :) Thanks Gaurav Khurana
also after checking the right file name which should be 'webpack.config.js', a good note is to check where the 'webpack.config.js' file is located. it should be in the same folder as your package.json file is located
You have a typo somewhere in your webpack.config.js
file. Review your config file. Had similar problem and it was as a result of a typo.
Also double-check that the webpack.config.js
file is in the right spot (in general, the root directory of the project) and the paths listed in the config file are correct.
Following are the things to check when you get this error.