NodeJS 如何解决npm错误:在解决......时发现......?

rkue9o1l  于 2023-01-20  发布在  Node.js
关注(0)|答案(1)|浏览(251)

我的项目使用Chakra-UIReact。当尝试运行npm install时,我得到了这个npm错误:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @choc-ui/chakra-autocomplete@5.1.2
npm ERR! Found: @chakra-ui/react@1.8.8
npm ERR! node_modules/@chakra-ui/react
npm ERR!   @chakra-ui/react@"latest" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @chakra-ui/react@"^2.2.8" from @choc-ui/chakra-autocomplete@5.1.2
npm ERR! node_modules/@choc-ui/chakra-autocomplete
npm ERR!   @choc-ui/chakra-autocomplete@"^5.1.2" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: react@18.2.0
npm ERR! node_modules/react
npm ERR!   peer react@">=18" from @chakra-ui/react@2.3.5
npm ERR!   node_modules/@chakra-ui/react
npm ERR!     peer @chakra-ui/react@"^2.2.8" from @choc-ui/chakra-autocomplete@5.1.2
npm ERR!     node_modules/@choc-ui/chakra-autocomplete
npm ERR!       @choc-ui/chakra-autocomplete@"^5.1.2" 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.

我不明白这个错误,我尝试删除node_modulespackage-lock.json,再次运行npm install,但同样的错误。

w46czmvw

w46czmvw1#

再次运行npm install --legacy-peer-deps,它将解决您的问题

相关问题