安装时NPX创建反应显示错误

发布于 2025-01-20 14:32:25 字数 1795 浏览 0 评论 0 原文

安装时 npx create-react-app shoing 错误,请帮我解决这个问题 问题。我的nodejs版本是v16.14.2,npm版本是8.5.0

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...


added 1354 packages in 1m

171 packages are looking for funding
run `npm fund` for details

Initialized a git repository.

Installing template dependencies using npm...
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"^18.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"<18.0.0" from @testing-library/[email protected]
npm ERR! node_modules/@testing-library/react
npm ERR!   @testing-library/react@"^12.0.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 /home/psn/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/psn/.npm/_logs/2022-04-12T07_12_21_032Z-debug-0.log
`npm install --no-audit --save @testing-library/jest-dom@^5.14.1 @testing- 
library/react@^12.0.0 @testing-library/user-event@^13.2.1 web-vitals@^2.1.0` failed

npx create-react-app shoing eror whent installing, please help me how to solve this
problem. my nodejs version is v16.14.2 and npm version is 8.5.0

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...


added 1354 packages in 1m

171 packages are looking for funding
run `npm fund` for details

Initialized a git repository.

Installing template dependencies using npm...
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"^18.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"<18.0.0" from @testing-library/[email protected]
npm ERR! node_modules/@testing-library/react
npm ERR!   @testing-library/react@"^12.0.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 /home/psn/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/psn/.npm/_logs/2022-04-12T07_12_21_032Z-debug-0.log
`npm install --no-audit --save @testing-library/jest-dom@^5.14.1 @testing- 
library/react@^12.0.0 @testing-library/user-event@^13.2.1 web-vitals@^2.1.0` failed

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

怪我入戏太深 2025-01-27 14:32:25

听起来像您正在运行 npx create-react-app 命令中,该命令已经包含了React。尝试运行 NPM安装

如果那不起作用,请尝试删除您的node_modules文件夹,然后再次运行 npm install

Sounds like you are running npx create-react-app command in a project that already includes react. Try running npm install instead.

If that does not work try to remove your node_modules folder and run npm install again.

奢华的一滴泪 2025-01-27 14:32:25

您可以尝试以下内容:

  1. 删除 node_modules package> package> lock.json
  2. run npm i web-vitals -save-dev
  3. run NPM安装

You can try the following:

  1. Delete both node_modules and package-lock.json
  2. Run npm i web-vitals --save-dev
  3. Run npm install
悲歌长辞 2025-01-27 14:32:25

如果您想创建一个项目(下一个或反应一个项目),并且存在一些类似类型的错误。尝试使用以下命令重新安装NPX。那对我有用。

npm i -g npx

If you are trying to create a project ( either next or react one ), and there is some similar type of error. try to reinstall npx with following command. That worked for me.

npm i -g npx
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文