为什么我有下面的错误
PS C:\Users\USER\Desktop\Shareme\shareme_frontend> npm install @sanity/client @sanity/image-url react-google-login react-icons react-loader-spinner react-masonry-css react-router-dom uuid
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: shareme_frontend@0.1.0
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR! react@"^18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16 || ^17" from react-google-login@5.2.2
npm ERR! node_modules/react-google-login
npm ERR! react-google-login@"*" 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 C:\Users\USER\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\USER\AppData\Local\npm-cache\_logs\2022-06-29T15_11_18_949Z-debug-0.log
3条答案
按热度按时间amrnrhlw1#
react-google-login没有更新到最新的react v18。要么等待更新,降级react到v17,要么使用--force标志。
请注意,使用--force并不能保证此软件包将与react的v18一起工作。
jvidinwx2#
react-google-login@5.2.2
与react 18版本不兼容,因为5.2.2是一年前根据npm page.发布的它仍然在寻找17 / 16的react版本。下面的错误块会告诉你这一点:
您可以通过以下方式为该特定项目降级react:
1.删除node_modules
1.运行
npm cache clean
1.手动更新package.json以将react版本更改为17
1.运行
npm install
ss2ws0br3#
您可以使用此命令通过命令行进行安装: