timarney / react-app-rewired

Override create-react-app webpack configs without ejecting
MIT License
9.79k stars 425 forks source link

react-app-rewired npm install not working with node v15 #527

Closed stedda closed 2 years ago

stedda commented 3 years ago

Hi guys, trying to install

"react-app-rewire-antd-theme": "^1.1.4",
"react-app-rewire-less": "^2.1.3",
"react-app-rewired": "^2.1.6",

with node -v 15.12. On npm install this error shows up:

npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: adhoc-web@0.1.1
npm ERR! Found: react-app-rewired@2.1.8
npm ERR! node_modules/react-app-rewired
npm ERR!   dev react-app-rewired@"^2.1.6" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react-app-rewired@"^1.5.2" from react-app-rewire-less@2.1.3
npm ERR! node_modules/react-app-rewire-less
npm ERR!   dev react-app-rewire-less@"^2.1.3" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Mentioning that with node v14 it works just fine.

Thanks

dawnmist commented 3 years ago

I believe react-app-rewire-less was written for webpack 2/3, and hadn't been upgraded to webpack 4+. Hence it needs the version 1 generation of react-app-rewired. If you're working on a modern CRA project, you'll need version 2 with webpack 4+ rewires.

Try using addLessLoader from customize-cra for adding less instead.