node.js - 由于依赖冲突,npm chakra-ui 安装失败

标签 node.js reactjs npm chakra-ui

我正在尝试学习 react/typescript,并且正在逐行学习教程,但是在尝试安装 @chakra-ui/react 或 @chakra-ui/core 时不知何故出现了这个错误。这似乎是 react 已更新的依赖性问题。我应该回滚 react 吗?

kyoudai.industries git:(master) ✗ npm install @chakra-ui/react framer-motion
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: kyoudai.industries@1.0.0
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR!   react@"^17.0.1" from the root project
npm ERR!   peer react@"16.x || 17.x" from @chakra-ui/react@1.0.1
npm ERR!   node_modules/@chakra-ui/react
npm ERR!     @chakra-ui/react@"*" from the root project
npm ERR!   2 more (@emotion/react, @emotion/styled)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8" from framer-motion@2.9.4
npm ERR! node_modules/framer-motion
npm ERR!   framer-motion@"*" from the root project
npm ERR!   peer framer-motion@"^2.9.4" from @chakra-ui/react@1.0.1
npm ERR!   node_modules/@chakra-ui/react
npm ERR!     @chakra-ui/react@"*" 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 /Users/travis/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/travis/.npm/_logs/2020-11-24T22_38_57_297Z-debug.log

最佳答案

用这个命令可以解决问题:

npm i @chakra-ui/react --legacy-peer-deps

关于node.js - 由于依赖冲突,npm chakra-ui 安装失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64995946/

相关文章:

javascript - 创建带有悬停按钮的 React 列表

reactjs - 在另一个组件中定义 React Router 路由

javascript - 使用 Mapbox 更新 Prop 的正确方法

javascript - npm 读取 package.json 后,运行 Electron 的是什么?

node.js - 使用npm程序调用dialogflow API失败

javascript - 从字符串用 node.js 编译 scss

javascript - 导入 Nunjucks 宏?

node.js - 澄清 npm install 的 --save 选项

如果它不为空,则调用回调函数的 Javascript 简写?

node.js - 我应该在哪里存储访问 token