The installed Node.js and key related modules are:

Node. Js v14.15.3

NPM 6.14.9

Webpack – cli 4.2.0

Webpack 5.11.0

Webpack dev – server 3.11.0

Start the command behavior of web-dev-server:

npx webpack-dev-server --open
Copy the code

The execution result is shown as follows:

The problem is mostly due to version compatibility issues between Webpack and Webpack-dev-server. Netizens’ solutions are also mandatory to specify a specific version, such as:

"devDependencies": {
    "webpack": "^ 5.2.0." "."webpack-cli": "^" 3.3.12."webpack-dev-server": "^ 3.11.0"
}
Copy the code

# # # # # # # # # # # # # # # # # # # # # You could try changing webpack-dev-server to webpack serve in your npm run script inside package.json. This is a useful answer particular when your project has these versions webpack”: “^5.2.0 webpack-cli”: “^ 4.1.0 webpack dev – server” : “^ 3.11.0.

I tried using the following command line and it worked:

npx webpack serve --open
Copy the code

Using webpack-dev-server in the official documentation of WebPack 5.11, the NPM script is also used in this way:

{..."scripts": {..."start": "webpack serve --open"},... }Copy the code

The original is not corrected by…..