我试图在模拟器中加载我的应用程序并不断收到此错误:
ERROR Invariant Violation: requireNativeComponent: "FastImageView" was not found in the UIManager.
This error is located at:
in FastImageView (created by FastImageBase)
in RCTView (created by View)
in View (created by FastImageBase)
in FastImageBase (created by FastImage)
in FastImage (created by GenerateRandomSurvivor)
in RCTView (created by View)
in View (created by GenerateRandomSurvivor)
in GenerateRandomSurvivor (created by App)
in RCTView (created by View)
in View (created by App)
in App
in RCTView (created by View)
in View (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer
in DBDRandomizer(RootComponent), js engine: hermes
使用这个package.json:
{
"name": "DBDRandomizer",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"start:dev": "ENVFILE=.env.dev react-native run-ios",
"start:test": "ENVFILE=.env.test react-native run-ios",
"start:prod": "ENVFILE=.env.prod react-native run-ios",
"start-web": "npx react-native start --web",
"test": "jest"
},
"dependencies": {
"axios": "^1.6.1",
"react": "^18.2.0",
"react-native": "^0.73.2",
"react-native-config": "^1.5.1",
"react-native-dotenv": "^3.4.9",
"react-native-fast-image": "^8.5.9"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"metro-react-native-babel-preset": "^0.77.0",
"@react-native/eslint-config": "^0.73.1",
"@react-native/metro-config": "^0.73.3",
"@react-native/typescript-config": "^0.73.1",
"@types/react": "^17.0.2",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"babel-plugin-react-native-web": "^0.19.10",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-native-flipper": "^0.209.0",
"react-test-renderer": "^18.2.0",
"typescript": "5.0.4"
},
"engines": {
"node": ">=20"
}
}
我尝试过以下方法:
yarn cache clean
rm -rf node_modules
rm -rf ~/Library/Developer/Xcode/DerivedData/*
cd ios && pod install
yarn react-native start --reset-cache
我还花了几个小时尝试不同版本的react、react-native、react-native-fast-image、react-native-flipper、react-test-renderer以及更多版本,试图找到一组工作版本。虽然有些错误导致了其他错误,但没有一个能解决问题。我最终恢复到没有关于不匹配版本的警告。我会列出我尝试过的变体,但我没有先见之明将它们写下来。对不起。
这看起来很像一个依赖性问题,但我在这个生态系统中很难追踪它。有没有一个工具可以找到我不知道的匹配反应版本?有人可以在这里教我钓鱼吗?我是不是偏离了基地,还有别的事情吗?
这是
react-native-fast-image
建议:
rm -rf node_modules && yarn
watchman watch-del-all
react-native start --reset-cache
rm -rf ios/build
cd ios && pod repo update
cd ios && pod install
我知道您尝试了其中的几种,但请再尝试一次。我还会尝试在构建之前但在重置所有缓存和内容之后从您的设备/模拟器中删除该应用程序。如果这些不起作用,抱歉。我不知道有一个用于匹配反应版本等的工具。不过,这是一个好主意,该软件包已经使用了快两年了,可能只是与您的其他软件包不兼容。