How to fix Insufficient number of arguments or no entry found. Alternatively, run 'webpack(-cli) --help' for usage info

Fix for your issue is mentioned below

webpack.config.js and package.json will always be in your project basepath and node commands should be triggered from this path

You must make below corrections in your webpack.config.js & package.json

package.json

--watch will automatically look for the file specified in entry object in webpack.config.js and keep watching its dependency graph to autoreload on detecting changes. You need to update your package.json with below details

"scripts": {
    "webpack" : "webpack", // invoke this command from npm run dev & npm run build
    "dev": "npm run webpack -- --mode development --watch",
    "build": "npm run webpack -- --mode production"
}

Running in watch mode could lead to performance issues depending on the hardware you are using, read more about it

webpack.config.js

Add entry object to your webpack.config.js. If you didn't override entry object, by default, webpack points entry object to './src/index.js`. As you are not using default configuration in your project, webpack throws the error

ERROR in Entry module not found: Error: Can't resolve './src' in '/root/../coding_challenge'

To fix the error, you need to override the entry object with your target js file as shown below

module.exports = {
  entry : "./frontend/src/index.js",
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader"
        }
      }
    ]
  }
}

if above corrections are done,

npm run dev will run your project in watch mode

npm run build will generate production build for your project

Let me know if this info fixes your problem


I had this issue, and realised that the name webpack.config.js had a white space character in it.

enter image description here