[英]npm ERR! Conflicting peer dependency: react@18.0.0
I can't seem to understand why this error is happening.我似乎无法理解为什么会发生此错误。 I am trying to create a new react-native project with another already created and in a different directory which is not lower in the directory tree than the other installation.
我正在尝试创建一个新的 react-native 项目和另一个已经创建的项目,并且位于目录树中不低于其他安装的不同目录中。 I have uninstalled and reinstalled the node which I thought might be the issue.
我已经卸载并重新安装了我认为可能是问题的节点。 I used brew doctor and removed a previous install of homebrew which I had in
usr/local/includes
我使用了 brew doctor 并删除了我在
usr/local/includes
中之前安装的自制软件
I'm trying to get a clean install of React-native but It appears I can't do so.我正在尝试全新安装 React-native,但我似乎无法这样做。
Thank you for any help.感谢您的任何帮助。
This is the error I keep getting这是我不断收到的错误
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react-native@0.67.4
npm ERR! node_modules/react-native
npm ERR! peer react-native@"*" from @react-native-community/cli@6.4.0
npm ERR! node_modules/@react-native-community/cli
npm ERR! @react-native-community/cli@"^6.0.0" from react-native@0.67.4
npm ERR! react-native@"0.69.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! react-native@"0.69.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@18.0.0
npm ERR! node_modules/react
npm ERR! peer react@"18.0.0" from react-native@0.69.1
npm ERR! node_modules/react-native
npm ERR! react-native@"0.69.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 ERR!
npm ERR! See /Users/Name/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Name/.npm/_logs/2022-07-14T06_15_09_791Z-debug-0.log
在命令末尾添加 --legacy-peer-deps
--legacy-peer-deps
I have the same issue as yours.我和你有同样的问题。 To fix the error.
修复错误。
Open cli then type: open /Users/Name/.npm
then delete folders _cacache, _logs, _npx.打开 cli 然后输入:
open /Users/Name/.npm
然后删除文件夹 _cacache、_logs、_npx。
After deleting those folders I'm able to install new React Native project.删除这些文件夹后,我可以安装新的 React Native 项目。
For Windows Users:对于 Windows 用户:
Open C:\Users\%username%\AppData\Local\npm-cache
then delete folders _cacache
, _logs
, _npx
打开
C:\Users\%username%\AppData\Local\npm-cache
然后删除文件夹_cacache
, _logs
, _npx
After deleting those folders, I can install a new React Native project on my windows pc.删除这些文件夹后,我可以在我的 windows 电脑上安装一个新的 React Native 项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.