Я пытаюсь использовать реакцию-три-волокна в реакции-родной. При попытке установить и запустить его согласно инструкции возникает следующая ошибка.
Когда я запускаю установку npm, возникает следующая ошибка. Можете ли вы сказать мне, почему это происходит?
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! react@"18.2.0" from the root project
npm ERR! peer react@"*" from @react-native/[email protected]
npm ERR! node_modules/@react-native/virtualized-lists
npm ERR! @react-native/virtualized-lists@"0.74.85" from [email protected]
npm ERR! node_modules/react-native
npm ERR! react-native@"0.74.3" from the root project
npm ERR! 2 more (@react-native/virtualized-lists, @react-three/fiber)
npm ERR! 9 more (@react-three/fiber, react-use-measure, its-fine, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^18.3.1" from [email protected]
npm ERR! node_modules/react-dom
npm ERR! peerOptional react-dom@">=18.0" from @react-three/[email protected]
npm ERR! node_modules/@react-three/fiber
npm ERR! @react-three/fiber@"^8.16.8" from the root project
npm ERR! peer react-dom@">=16.13" from [email protected]
npm ERR! node_modules/@react-three/fiber/node_modules/react-use-measure
npm ERR! react-use-measure@"^2.1.1" from @react-three/[email protected]
npm ERR! node_modules/@react-three/fiber
npm ERR! @react-three/fiber@"^8.16.8" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react
npm ERR! peer react@"^18.3.1" from [email protected]
npm ERR! node_modules/react-dom
npm ERR! peerOptional react-dom@">=18.0" from @react-three/[email protected]
npm ERR! node_modules/@react-three/fiber
npm ERR! @react-three/fiber@"^8.16.8" from the root project
npm ERR! peer react-dom@">=16.13" from [email protected]
npm ERR! node_modules/@react-three/fiber/node_modules/react-use-measure
npm ERR! react-use-measure@"^2.1.1" from @react-three/[email protected]
npm ERR! node_modules/@react-three/fiber
npm ERR! @react-three/fiber@"^8.16.8" 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!
npm ERR! For a full report see:
npm ERR! /Users/m/.npm/_logs/2024-07-16T16_01_32_801Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in: /Users/m/.npm/_logs/2024-07-16T16_01_32_801Z-debug-0.log
Установку закончил так, все пошло по мануалу.
Однако когда я запускаю установку npm, возникает ошибка, и я не знаю, почему она возникает. Вы можете дать мне какой-то совет?
1. npx react-native init temp --template react-native-template-typescript --pm npm
2. npx install-expo-modules@latest
3. expo install expo-gl
4. npm install three @react-three/fiber
5. make file in project root > metro.config.js.
module.exports = {
resolver: {
sourceExts: ['js', 'jsx', 'json', 'ts', 'tsx', 'cjs', 'mjs'],
assetExts: ['glb', 'gltf', 'png', 'jpg'],
},
}
6. npm install <<<<< error return
Я наконец-то нашел подходящий мне способ: сменить версию реакции на 18.2.0, а затем установить реакцию-дом, чтобы обе версии были одинаковыми, как эта
"react": "18.2.0",
"react-dom": "18.2.0"
Я думаю, что последняя версия реакции не поддерживает реакцию-native-fiber или что-то не так
я не знаю, что это правильно, но мне помогло