【问题标题】:Npm dependency issue: react 17.0.2 and "react-swipeable-views": "0.13.9"Npm 依赖问题:react 17.0.2 和“react-swipeable-views”:“0.13.9”
【发布时间】:2021-07-29 09:22:07
【问题描述】:

我正在尝试从

设置材料仪表板
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.

我该如何解决这个问题。

【问题讨论】:

    标签: reactjs npm react-swipeable-views


    【解决方案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.x.x 范围内,然后重新运行

    npm install
    

    所以它会满足对等依赖。

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

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

    https://semver.npmjs.com/

    【讨论】:

    • 将 react-swipeable-views 更新到最新版本解决了 react@17.0.2 的问题
    猜你喜欢
    • 1970-01-01
    • 2022-10-23
    • 2020-12-01
    • 2021-12-05
    • 1970-01-01
    • 2023-01-11
    • 1970-01-01
    • 1970-01-01
    • 2023-04-11
    相关资源
    最近更新 更多