Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-scripts required old version of webpack

I installed webpack into my react project, but the same error occurred every time when I use npm start:

The react-scripts package provided by Create React App requires a dependency:

"webpack": "4.42.0"

Don't try to install it manually: your package manager does it automatically. However, a different version of webpack was detected higher up in the tree:

C:\react\minimoj\node_modules\webpack (version: 4.43.0)

I tried to remove package-loc.json file + all node_modules + remove webpack name from package.json and reinstall it with npm install. Also I tried same with yarn, but it didn't help. I see that in node_modules version is 4.43 and after I use npm install webpack in the file package-loc.json it shows 4.43, but at the moment when I use npm start it changed to 4.42 and error occur. In addition I also reinstall node.js but it didn't help.

like image 835
andrrrrrre Avatar asked May 26 '20 20:05

andrrrrrre


2 Answers

create .env file and add SKIP_PREFLIGHT_CHECK=true

like image 191
Edvin Saletovic Avatar answered Dec 16 '22 02:12

Edvin Saletovic


I had similar with a newer webpack version being installed than what react_scripts required. To fix I deleted webpack and webpack-dev-server from my project's node_modules, went to a console outside of the project dir and ran

npm uninstall webpack
npm uninstall webpack-dev-server

Then ran

npm install
npm run build

And all was well, as my package.json was correct without change.

like image 22
Hemmels Avatar answered Dec 16 '22 02:12

Hemmels