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 > [email protected] 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! [email protected] start: `webpack-dev-server --hot` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] 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! [email protected] start: `webpack-dev-server --hot` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] 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>
npm install webpack-cli -D^, remove yournode_modulesand runnpm installagain. like so stackoverflow.com/a/40602514/3415716