React Native iOS端报RCTScrollView重复注册错误求助
Hey there, this error usually pops up when iOS ends up with duplicate registrations of the RCTScrollView component—either from conflicting dependencies, redundant manual linking, or cached build artifacts. Since your Android build works fine, it's definitely an iOS-specific linking/caching issue. Let's walk through the most effective fixes tailored to your setup (RN 0.61.5, Xcode 11.5):
1. Nuke Build Caches & Reinstall Dependencies
Start with the basics—corrupted caches are often the culprit:
- First, wipe your node modules and reinstall:
rm -rf node_modules package-lock.json yarn.lock npm install # or yarn install - Next, clean up iOS Pods completely (critical for RN 0.60+ auto-linking):
cd ios pod deintegrate rm -rf Podfile.lock pod install - Finally, clear Xcode's build cache:
- Open Xcode, go to
Product > Clean Build Folder(Cmd+Shift+K) - Delete Xcode's Derived Data: Go to
Xcode > Preferences > Locations, click the arrow next to Derived Data, and delete the folder for your project.
- Open Xcode, go to
2. Check for Redundant Manual Linking
RN 0.60+ uses auto-linking, but some older dependencies might still have leftover manual links that conflict with core RN components:
- Open your iOS project in Xcode, navigate to the
Librariesfolder. - Look for any entries related to
RCTScrollViewor third-party libraries that might include their own version of it (e.g., video SDKs like opentok-react-native, image cropping tools). - If you find duplicate entries, remove the manual link (right-click > Delete, and make sure to remove references from your project's Build Phases > Link Binary With Libraries).
3. Audit Your Dependencies for Conflicts
Looking at your dependency list, a few packages could be causing clashes with RN's core RCTScrollView:
- opentok-react-native@0.12.2: Older versions of this SDK sometimes bundled their own RN components. Try upgrading to a version compatible with RN 0.61.x or temporarily removing it to see if the error goes away.
- react-native-amazing-cropper/react-native-image-crop-tools: Image handling libraries might include scroll view components that conflict. Test removing one of these to isolate the issue.
- Check your
Podfile.lockfor duplicate entries ofRCTScrollViewor related pods. Search for "RCTScrollView"—if you see it listed under multiple sources, that's a red flag.
4. Adjust Podfile Settings
If you're still stuck, try modifying your iOS Podfile to avoid static linking conflicts:
- Add
use_frameworks!at the top of your Podfile (note: some RN libraries don't support this, so test carefully):platform :ios, '10.0' use_frameworks! # Add this line require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' target 'YourProjectName' do # ... rest of your Podfile end - After adding this, run
pod deintegrate && pod installagain.
5. Replace Outdated Dependencies
Some of your packages are very outdated (like react-native-file-picker@0.0.19) and might not play nice with RN 0.61.5. Consider replacing deprecated packages with maintained alternatives—for example, use react-native-document-picker instead of the unmaintained react-native-file-picker.
Once you've tried these steps, rebuild your iOS project in Xcode or run react-native run-ios—the duplicate registration error should be resolved.
内容的提问来源于stack exchange,提问作者Rebirth Bloods

