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

Tra*_*vis 2 node.js npm reactjs chakra-ui

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

\n
kyoudai.industries git:(master) \xe2\x9c\x97 npm install @chakra-ui/react framer-motion\nnpm ERR! code ERESOLVE\nnpm ERR! ERESOLVE unable to resolve dependency tree\nnpm ERR! \nnpm ERR! While resolving: kyoudai.industries@1.0.0\nnpm ERR! Found: react@17.0.1\nnpm ERR! node_modules/react\nnpm ERR!   react@"^17.0.1" from the root project\nnpm ERR!   peer react@"16.x || 17.x" from @chakra-ui/react@1.0.1\nnpm ERR!   node_modules/@chakra-ui/react\nnpm ERR!     @chakra-ui/react@"*" from the root project\nnpm ERR!   2 more (@emotion/react, @emotion/styled)\nnpm ERR! \nnpm ERR! Could not resolve dependency:\nnpm ERR! peer react@"^16.8" from framer-motion@2.9.4\nnpm ERR! node_modules/framer-motion\nnpm ERR!   framer-motion@"*" from the root project\nnpm ERR!   peer framer-motion@"^2.9.4" from @chakra-ui/react@1.0.1\nnpm ERR!   node_modules/@chakra-ui/react\nnpm ERR!     @chakra-ui/react@"*" from the root project\nnpm ERR! \nnpm ERR! Fix the upstream dependency conflict, or retry\nnpm ERR! this command with --force, or --legacy-peer-deps\nnpm ERR! to accept an incorrect (and potentially broken) dependency resolution.\nnpm ERR! \nnpm ERR! See /Users/travis/.npm/eresolve-report.txt for a full report.\n\nnpm ERR! A complete log of this run can be found in:\nnpm ERR!     /Users/travis/.npm/_logs/2020-11-24T22_38_57_297Z-debug.log\n
Run Code Online (Sandbox Code Playgroud)\n

Emi*_*edi 8

通过这个命令就可以解决这个问题:

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