Npm dependency issue: react 17.0.2 and "react-swipeable-views": "0.13.9"

4.6k Views Asked by At

I am trying to setup material dashboard from

git clone https://github.com/creativetimofficial/material-dashboard-react.git.

Using node-16

I run npm install

I get

npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"17.0.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^15.3.0 || ^16.0.0" from [email protected]
npm ERR! node_modules/react-swipeable-views
npm ERR!   react-swipeable-views@"0.13.9" 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.
npm ERR! 
npm ERR! See /home/simha/.npm/eresolve-report.txt for a full report.

How can I resolve this.

1

There are 1 best solutions below

1
Josiah Monks On

It looks like the root project installs [email protected]. But "react-swipeable-views" requires version 15 or 16 of react.

Edit: As a first option, you could try updating "react-swipeable-views" to its latest version. It may possibly support React 17. The following command will update it.

npm install react-swipeable-views@latest

If this doesn't work...

Try reducing the numbers for react in the package.json to something in the 16.x.x range, then re-run

npm install

so it will satisfy the peer dependency.

https://docs.npmjs.com/about-semantic-versioning

If you're not familiar with NPM semantic versioning, use this calculator. Enter react -> "^16.0.0" to see that it does not include 17

https://semver.npmjs.com/