我有一个barebone react项目。由于这是一个新项目,我将所有软件包升级到最新版本。但是npm install失败了
garg1@TVQRL MINGW64 /d/coding/github/erodov/app
$ npm i -g npm-check-updates
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
added 288 packages, and audited 289 packages in 19s
55 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
garg1@TVQRL MINGW64 /d/coding/github/erodov/app
$ ncu -u
Upgrading D:codinggithuberodovapppackage.json
[====================] 12/12 100%
@testing-library/jest-dom ^5.11.5 → ^5.16.4
@testing-library/react ^11.1.0 → ^13.3.0
@testing-library/user-event ^12.1.10 → ^14.2.1
bootstrap ^5.0.0-beta2 → ^5.1.3
react ^17.0.1 → ^18.2.0
react-dom ^17.0.1 → ^18.2.0
react-router-dom ^5.2.0 → ^6.3.0
react-scripts 4.0.0 → 5.0.1
web-vitals ^0.2.4 → ^2.1.4
Run npm install to install new versions.
garg1@TVQRL MINGW64 /d/coding/github/erodov/app
$ npm i
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: frontend2@0.1.0
npm ERR! Found: @testing-library/react@11.2.7
npm ERR! node_modules/@testing-library/react
npm ERR! @testing-library/react@"^13.3.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @testing-library/react@"^13.3.0" 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.0.0" from @testing-library/react@13.3.0
npm ERR! node_modules/@testing-library/react
npm ERR! @testing-library/react@"^13.3.0" 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:Usersgarg1AppDataLocalnpm-cacheeresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:Usersgarg1AppDataLocalnpm-cache_logs2022-07-02T20_59_18_305Z-debug-0.log
错误日志提示运行npm i --force
或npm i --legacy-peer-deps
无害吗?
我删除了包锁。
安装前的Json文件我删除了node_modules
文件夹,并再次安装,这次它工作了。