'Unable to Update Webpack for React Project

Right now my current project is using an old version of webpack (3.5.1) and I need to update it to a version that can understand object spread because an npm module would not compile because of older webpack version.

If I run npm update webpack I get the following error:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/webpack
npm ERR!   webpack@"3.5.1" from the root project
npm ERR!   peer webpack@"2 || 3" from [email protected]
npm ERR!   node_modules/babel-loader
npm ERR!     babel-loader@"7.1.1" from the root project
npm ERR!   10 more (extract-text-webpack-plugin, file-loader, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^4.0.0" from [email protected]
npm ERR! node_modules/css-loader
npm ERR!   dev css-loader@"1.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/webpack
npm ERR!   peer webpack@"^4.0.0" from [email protected]
npm ERR!   node_modules/css-loader
npm ERR!     dev css-loader@"1.0.1" from the root project

I tried to force update but it didn't work either.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source