4

I am trying to start with reactJS and gone through tutorial. after running the app npm start I am getting this error.

Error:

E:\ReactUI\myReact>npm start

> reviewpedia@1.0.0 start E:\ReactUI\myReact
> webpack-dev-server --hot

The CLI moved into a separate package: webpack-cli.
Please install 'webpack-cli' in addition to webpack itself to use the CLI.
-> When using npm: npm install webpack-cli -D
-> When using yarn: yarn add webpack-cli -D
module.js:540
    throw err;
    ^

Error: Cannot find module 'webpack-cli/bin/config-yargs'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (E:\ReactUI\myReact\node_modules\webpack-dev-server\bin\webpack-dev-server.js:65:1)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reviewpedia@1.0.0 start: `webpack-dev-server --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reviewpedia@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Admin\AppData\Roaming\npm-cache\_logs\2018-06-08T04_54_55_281Z-debug.log

E:\ReactUI\myReact>

I changed the webpavk from "webpack": "^4.10.2", "webpack-dev-server": "^3.1.4" but still the error is same.

Here is my package.json

{
  "name": "myApp",
  "version": "1.0.0",
  "description": "XYZ",
  "main": "index.js",
  "scripts": {
    "start": "webpack-dev-server --hot"
  },
  "keywords": [
    "React",
    "App"
  ],
  "author": "XYZ",
  "license": "MIT",
  "dependencies": {
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.4",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "react": "^16.4.0",
    "react-dom": "^16.4.0",
    "webpack": "^2.1.0-beta.25",
    "webpack-dev-server": "^3.1.4"
  }
}

Please help me to resolve this.

PS : I am using this example: Tutorial Points

And after installing npm install webpack-cli -D I got the following error.

E:\ReactUI\myReact\node_modules\webpack-cli\bin\convert-argv.js:156
                const webpackConfigurationValidationErrors = validateSchema(
                                                             ^

TypeError: validateSchema is not a function
    at processConfiguredOptions (E:\ReactUI\myReact\node_modules\webpack-cli\bin\convert-argv.js:156:48)
    at module.exports (E:\ReactUI\myReact\node_modules\webpack-cli\bin\convert-argv.js:150:10)
    at Object.<anonymous> (E:\ReactUI\myReact\node_modules\webpack-dev-server\bin\webpack-dev-server.js:234:54)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reviewpedia@1.0.0 start: `webpack-dev-server --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reviewpedia@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Admin\AppData\Roaming\npm-cache\_logs\2018-06-08T05_31_50_201Z-debug.log

E:\ReactUI\myReact>
David
  • 4,266
  • 8
  • 34
  • 69
  • 5
    Read the warnings: please install the webpack cli: `npm install webpack-cli -D` – Leo Caseiro Jun 08 '18 at 05:28
  • 1
    @LeoCaseiro After running the command i got some error. I updated in questions. Thanks for throwing some light. – David Jun 08 '18 at 05:34
  • it seems you're having compatibility issues with some versions. Please force the library versions without the `^`, remove your `node_modules` and run `npm install` again. like so https://stackoverflow.com/a/40602514/3415716 – Leo Caseiro Jun 08 '18 at 05:40
  • Possible duplicate of [Cannot find module 'webpack/bin/config-yargs'](https://stackoverflow.com/questions/40379139/cannot-find-module-webpack-bin-config-yargs) – serv-inc May 14 '19 at 12:33

0 Answers0