当运行命令npm install时,我得到了与react版本的项目对我的最新版本的兼容性错误
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: mini-create-react-context@0.4.1
npm WARN Found: react@18.2.0
npm WARN node_modules/react
npm WARN react@"18.2.0" from the root project
npm WARN 8 more (@hypnosphi/create-react-context, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" from mini-create-react-context@0.4.1
npm WARN node_modules/mini-create-react-context
npm WARN mini-create-react-context@"^0.4.0" from react-router@5.2.0
npm WARN node_modules/react-router
npm WARN
npm WARN Conflicting peer dependency: react@17.0.2
npm WARN node_modules/react
npm WARN peer react@"^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" from mini-create-react-context@0.4.1
npm WARN node_modules/mini-create-react-context
npm WARN mini-create-react-context@"^0.4.0" from react-router@5.2.0
npm WARN node_modules/react-router
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-chartjs-2@2.11.1
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR! react@"18.2.0" from the root project
npm ERR! peer react@">=0.14.0" from @hypnosphi/create-react-context@0.3.1
npm ERR! node_modules/@hypnosphi/create-react-context
npm ERR! @hypnosphi/create-react-context@"^0.3.1" from react-popper@1.3.11
npm ERR! node_modules/react-popper
npm ERR! react-popper@"^1.3.6" from reactstrap@8.7.1
npm ERR! node_modules/reactstrap
npm ERR! reactstrap@"8.7.1" from the root project
npm ERR! 7 more (@testing-library/react, react-dom, react-router, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" from react-chartjs-2@2.11.1
npm ERR! node_modules/react-chartjs-2
npm ERR! react-chartjs-2@"2.11.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@17.0.2
npm ERR! node_modules/react
npm ERR! peer react@"^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" from react-chartjs-2@2.11.1
npm ERR! node_modules/react-chartjs-2
npm ERR! react-chartjs-2@"2.11.1" 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 install步骤如下:
https://demos.creative-tim.com/blk-design-system-react//文档/教程
你使用的是react 18.2.0版本,但是react-router 5.2.0版本只支持react 17.0.0版本。如果你仍然想使用react-router 5.2.0版本,请将react版本降级到17.0.0或更低,否则请更新到react-router v6以支持react v18