Error: Cannot find module 'webpack-cli/bin/config-yargs' webpack-dev-server code example

Example 1: Error: Cannot find module 'webpack-cli/bin/config-yargs'

For webpack-cli 3.x:
"scripts": {
  "start:dev": "webpack-dev-server --mode=development"
}

For webpack-cli 4.x:
"scripts": {
  "start:dev": "webpack serve --mode=development"
}

Example 2: Error: Cannot find module 'webpack-cli/bin/config-yargs' Require stack: - /Users/collins/Desktop/react.teamtree/node_modules/webpack-dev-server/bin/webpack-dev-server.js

cnpm i webpack-cli -D
1

Tags:

Java Example