React 16 - 不正确的对等依赖
Posted
技术标签:
【中文标题】React 16 - 不正确的对等依赖【英文标题】:React 16 - Incorrect Peer Dependency 【发布时间】:2018-04-04 02:30:54 【问题描述】:迁移到 React 16 后,我收到了很多警告说存在不正确的对等依赖关系。
我怎样才能用纱线避免这些?
我尝试删除所有包,删除 yarn.lock,然后再次添加 yarn。
warning "react-textarea-autosize@4.3.2" has incorrect peer dependency "react@>=0.14.0 <16.0.0".
warning "react-modal@2.4.1" has incorrect peer dependency "react@^0.14.0 || ^15.0.0".
warning "react-modal@2.4.1" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.0".
warning "react-komposer@2.0.0" has incorrect peer dependency "react@^0.14.7 || ^15.0.0".
warning "react-treebeard@2.0.3" has incorrect peer dependency "react@^15.5.4".
warning "react-treebeard@2.0.3" has incorrect peer dependency "react-dom@^15.5.4".
warning "babel-loader@6.4.1" has unmet peer dependency "webpack@1 || 2 || ^2.1.0-beta || ^2.2.0-rc".
warning "chai-enzyme@0.8.0" has unmet peer dependency "cheerio@0.19.x || 0.20.x || 0.22.x || 1.0.0-rc.1".
warning "chai-enzyme@0.8.0" has incorrect peer dependency "enzyme@1.x || ^2.3.0".
warning "chai-enzyme@0.8.0" has incorrect peer dependency "react@^0.14.0 || ^15.0.0-0".
warning "chai-enzyme@0.8.0" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.0-0".
warning "react-element-to-jsx-string@5.0.7" has incorrect peer dependency "react@^0.14.8 || ^15.0.1".
warning "dirty-chai@1.2.2" has incorrect peer dependency "chai@<1.10.0 || >1.10.0 <4".
warning "material-ui-icons@1.0.0-beta.17" has incorrect peer dependency "material-ui@^1.0.0-beta.16".
warning "react-addons-test-utils@15.6.2" has incorrect peer dependency "react-dom@^15.4.2".
warning "sass-loader@6.0.6" has unmet peer dependency "webpack@^2.0.0 || >= 3.0.0-rc.0 || ^3.0.0".
【问题讨论】:
这个问题可能有助于回答你的问题:***.com/questions/42361942/… 【参考方案1】:运行“纱线升级”。它应该解决许多不正确的依赖关系。然后您应该将其余软件包的版本更改为适当的版本,但预计某些软件包会过时。
【讨论】:
以上是关于React 16 - 不正确的对等依赖的主要内容,如果未能解决你的问题,请参考以下文章
覆盖对等依赖项时出错 - npm install reactstrap