【问题标题】:I can't install npm install --save react-tilt我无法安装 npm install --save react-tilt
【发布时间】:2022-01-06 23:52:40
【问题描述】:
C:\Users\JohnSam\Desktop\React\smartapp>npm install --save react-tilt
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: smartbrain2@0.1.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.0.0 || ^16.0.0-beta || ^16.0.0" from react-tilt@0.1.4
npm ERR! node_modules/react-tilt
npm ERR!   react-tilt@"*" 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 C:\Users\Sengk\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Sengk\AppData\Local\npm-cache\_logs\2021-11-30T08_35_11_646Z-debug.log

【问题讨论】:

  • 看起来 react-tilt 还没有使用 React 17。你可以尝试降级你的 react 依赖,或者在 react-tilt 提出问题并等待更新

标签: reactjs npm npm-install


【解决方案1】:

错误说你使用的 React 版本(17.0.2)与react-tilt不兼容。

查看react-tiltpackage.json 文件时,您会发现它需要react@^15.0.0 || ^16.0.0-beta || ^16.0.0 的对等依赖关系。

NPM 自 npm v7 起默认强制执行正确的对等依赖。如果你真的想,你可以忽略这个检查并运行npm install --save --legacy-peer-deps react-tilt

请注意,这意味着无法保证此包完全适用于 React 17。

【讨论】:

    猜你喜欢
    • 2020-11-07
    • 2019-05-09
    • 1970-01-01
    • 1970-01-01
    • 2016-12-12
    • 2020-09-25
    • 1970-01-01
    • 2019-12-03
    • 1970-01-01
    相关资源
    最近更新 更多