reactjs - React-spring with gatsby - 安装时出错
问题描述
我正在尝试将 react-spring 添加到 gatsby(Gatsby 3.13.0,React 17.0.2)。当我输入“npm i react-spring”时,会出现这样的错误:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR! react@"^17.0.2" from the root project
npm ERR! peer react@"^16.8.0 || ^17.0.0" from @react-spring/core@9.2.4
npm ERR! node_modules/@react-spring/core
npm ERR! @react-spring/core@"~9.2.0" from react-spring@9.2.4
npm ERR! node_modules/react-spring
npm ERR! react-spring@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0" from react-reconciler@0.20.4
npm ERR! node_modules/react-zdog/node_modules/react-reconciler
npm ERR! react-reconciler@"^0.20.4" from react-zdog@1.0.11
npm ERR! node_modules/react-zdog
npm ERR! peer react-zdog@">=1.0" from @react-spring/zdog@9.2.4
npm ERR! node_modules/@react-spring/zdog
npm ERR! @react-spring/zdog@"~9.2.0" from react-spring@9.2.4
npm ERR! node_modules/react-spring
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!
我尝试了 --force 或 --legacy-peer-deps,但没有帮助。是 React 17 还是 Gatsby 的问题?
解决方案
我会安装您正在使用的特定目标。例如,由于您使用的是gatsby
我假设您希望@react-spring/web
这应该解决问题npm@7
。
推荐阅读
- amazon-web-services - AWS Lambda 函数将 X-Amz-Signature 附加到 S3 URL
- autolayout - Swift 编程 UI UIContextMenuInteraction 打开上下文菜单时自动布局错误(groupView)
- python - 根据自定义开始日期创建双周变量
- entity-framework-core - 为什么 Entity Framework Core 没有 Upsert (AddOrUpdate) 和 Synchronize(AddOrUpdateOrDelete) 命令?
- python - Python中的请求不向外部程序发送数据
- ansible - Ansible:如何使用从 FIND 模块中提取的文件?
- javascript - 有没有办法在 for 循环中使用 readline?
- json - 解析 Telegraf 的 json inputs.http 插件
- reactjs - 在 GridContainer 中使用两个 GridItem 时,小屏幕中的 Material-kit-react 问题
- sql - 基于位数的 SQL 查询