throw new _ValidationError.default(errors, schema, configuration); and requires a peer of webpack@^4.0.0 but none is installed

Viewed 552

I installed webpack in my project folder and hoping to run a simple interface to test around my front end by typing "npm run start" using cmd in the project folder. but I have received this error

error screenshot

I reinstall it and run "npm install" and did "npm audit fix" but receive warnings saying that require peer of webpack@^4.0

warning screenshot

it feel like it says that I did not install webpack. but I believe I have.

Here is the package.json

    {
  "name": "app",
  "version": "1.0.0",
  "description": "",
  "private": true,
  "scripts": {
    "build": "webpack",
    "start": "webpack-dev-server"
  },
  "devDependencies": {
    "copy-webpack-plugin": "^6.3.2",
    "webpack": "^5.9.0",
    "webpack-cli": "^3.3.10",
    "webpack-dev-server": "^3.11.0"
  },
  "dependencies": {
    "web3": "^1.2.4"
  }
}

Here is my webpack.config.js

 const path = require("path");
const CopyWebpackPlugin = require("copy-webpack-plugin");

module.exports = {
  entry: "./src/index.js",
  output: {
    filename: "index.js",
    path: path.resolve(__dirname, "dist"),
  },
  plugins: [
    new CopyWebpackPlugin([{ from: "./src/index.html", to: "index.html" }]),
  ],
  devServer: { contentBase: path.join(__dirname, "dist"), compress: true },
};

let me know what I did wrong here. Thank you

0 Answers
Related