Click here to Skip to main content
15,031,680 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

I'm new to ReactJs please help out of this issue i'm trying from past 2 days not able found any solution

C:\Users\user\Desktop\reactApp> npx webpack info

OS: Windows 10 10.0.19041
CPU: (8) x64 Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
Memory: 1.47 GB / 7.89 GB
Node: 12.14.0 - C:\Program Files\nodejs\node.EXE
npm: 7.6.3 - C:\Program Files\nodejs\npm.CMD
Chrome: 89.0.4389.90
Edge: Spartan (44.19041.423.0), Chromium (89.0.774.57)
Internet Explorer: 11.0.19041.1
html-webpack-plugin: ^5.3.1 => 5.3.1
webpack: ^5.27.1 => 5.27.1
webpack-cli: ^4.5.0 => 4.5.0
webpack-dev-server: ^3.11.2 => 3.11.2

this is my web-pack details
When i run my react application getting error like below

What I have tried:

PS C:\Users\user\Desktop\reactApp> npm start

> reactApp@1.0.0 start
> webpack-dev-server --mode development --open --hot

throw err;

Error: Cannot find module 'webpack-cli/bin/config-yargs'
Require stack:
- C:\Users\user\Desktop\reactApp\node_modules\webpack-dev-server\bin\webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
at Function.Module._load (internal/modules/cjs/loader.js:690:27)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (C:\Users\user\Desktop\reactApp\node_modules\webpack-dev-server\bin\webpack-dev-server.js:65:1)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
requireStack: [
Richard MacCutchan 1-May-21 8:52am
"Error: Cannot find module 'webpack-cli/bin/config-yargs'
Check the location in the error message for the missing file.

1 solution

If you're using webpack-cli 4 or webpack 5, change webpack-dev-server to webpack serve in your script key:

"scripts": {
"dev": "webpack serve"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900