-1

我正在尝试设置材料仪表板

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

使用node-16

我跑npm install

我明白了

npm ERR! While resolving: material-dashboard-react@1.10.0
npm ERR! Found: react@17.0.2
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 react-swipeable-views@0.13.9
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.

我该如何解决这个问题。

4

1 回答 1

1

看起来根项目安装了 react@17.0.2。但是“react-swipeable-views”需要 react 的 15 或 16 版本。

编辑:作为第一个选项,您可以尝试将“react-swipeable-views”更新到其最新版本。它可能支持 React 17。以下命令将对其进行更新。

npm install react-swipeable-views@latest

如果这不起作用...

尝试将 package.json 中的 react 数量减少到 16.xx 范围内,然后重新运行

npm install

所以它将满足对等依赖。

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

如果您不熟悉 NPM 语义版本控制,请使用此计算器。输入react -> "^16.0.0" 可以看到不包含17

https://semver.npmjs.com/

于 2021-07-29T17:56:45.143 回答