npm install react-masonry-css错误问题

prdp8dxp  于 12个月前  发布在  React
关注(0)|答案(1)|浏览(115)
PS E:\Share me\shareme_frontend\my-project> npm install react-masonry-css
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   peer react@"^18.0.0" from @testing-library/[email protected]
npm ERR!   node_modules/@testing-library/react
npm ERR!     @testing-library/react@"^13.4.0" from the root project
npm ERR!   peer react@"^18.2.0" from [email protected]
npm ERR!   node_modules/react-dom
npm ERR!     peer react-dom@"^18.0.0" from @testing-library/[email protected]
npm ERR!     node_modules/@testing-library/react
npm ERR!       @testing-library/react@"^13.4.0" from the root project
npm ERR!     peer react-dom@"^16.0.0 || ^17.0.0 || ^18.0.0" from [email protected]
npm ERR!     node_modules/react-loader-spinner
npm ERR!       react-loader-spinner@"^5.3.4" from the root project
npm ERR!     3 more (react-router-dom, styled-components, the root project)
npm ERR!   7 more (react-icons, react-loader-spinner, react-router, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16 || ^17" from [email protected]
npm ERR! node_modules/react-google-login
npm ERR!   react-google-login@"^5.2.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR!   peer react@"^16 || ^17" from [email protected]
npm ERR!   node_modules/react-google-login
npm ERR!     react-google-login@"^5.2.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.
npm ERR!
npm ERR! See C:\Users\pankaj kumar\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\pankaj kumar\AppData\Local\npm-cache\_logs\2022-11-01T08_45_55_070Z-debug-0.log
npm install react-masonry-css

但显示上误差,我可以解决它

npm install react-masonry-css --force
npm install react-masonry-css --legacy-peer-deps

这两种方法都已经试过了

x4shl7ld

x4shl7ld1#

在我的情况下,以下技巧有助于让项目工作。
步骤1:关闭项目
步骤2:从项目目录中删除.cache文件夹。它位于your_project_folder/node_modules/
步骤3:打开你的项目。我正在使用Visual Studio Code。
第四步:后藤进入VS Code终端执行yarn install命令,安装新包。
Step-5:运行您的项目或在终端执行yarn start命令。

相关问题