react-native: iOS Build Fail After upgrading from 0.57.8 to 0.58.1

Environment

  React Native Environment Info:
    System:
      OS: macOS 10.14.2
      CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
      Memory: 138.55 MB / 8.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 11.1.0 - /usr/local/bin/node
      npm: 6.6.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5056338
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3 
      react-native: ^0.58.1 => 0.58.1 
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7
      react-native-rename: 2.4.0

Description

I started project with version v0.57.8 I followed instruction here for upgrading to v0.58.1: https://facebook.github.io/react-native/docs/upgrading#upgrade-based-on-git After upgrading, Android app wasn’t responding to touches but after deleting and re-installing node_modules, plus --reset-cache it’s solved.

But on iOS build i still get this error(both on run-ios and Xcode):

PBXCp /.../RNApp/node_modules/react-native/ReactCommon/privatedata/PrivateDataBase.h /.../RNApp/ios/build/Build/Products/Debug-iphonesimulator/include/privatedata/PrivateDataBase.h (in target: privatedata)
    cd /.../RNApp/node_modules/react-native/React
    builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks /.../RNApp/node_modules/react-native/ReactCommon/privatedata/PrivateDataBase.h /.../RNApp/ios/build/Build/Products/Debug-iphonesimulator/include/privatedata

error: /.../RNApp/node_modules/react-native/ReactCommon/privatedata/PrivateDataBase.h: No such file or directory



** BUILD FAILED **



The following build commands failed:
	PBXCp /.../RNApp/node_modules/react-native/ReactCommon/privatedata/PrivateDataBase.h /.../RNApp/ios/build/Build/Products/Debug-iphonesimulator/include/privatedata/PrivateDataBase.h
(1 failure)

Reproducible Demo

$ react-native init --version 0.57.8 Dummy
$ react-native-git-upgrade
$ git apply $TMPDIR/react-native-git-upgrade/upgrade_0.57.8_0.58.1.patch
$ rm -rf node_modules && npm install
$ react-native run-ios -- --reset-cache

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 11
  • Comments: 17

Most upvoted comments

Ok, I think i found the solution. When i searched for files those include “PrivateDataBase.h” they all were under the /RNApp/ios/build folder. I think they are precompiled files for faster further builds and i guess they are safe to delete because build/ folder included in .gitignore file provided by react native.

Solution: Clear under /RNApp/ios/build/ folder and re-run react-native run-ios -- --reset-cache

I was having the same error /node_modules/react-native/ReactCommon/privatedata/PrivateDataBase.h: No such file or directory and this is how I fixed it.

  1. In the top menu, open ‘Product’ and click ‘Clean Build Folder’.
  2. Open Xcode ‘Preferences’ and navigate to the ‘Locations’ tab on the top right.
  3. Under the ‘Derived Data’ input, there is a path in grey text and an arrow icon next to it. Click the arrow icon.
  4. This will take you to your DerivedData folder in finder.
  5. With this folder open, Quit Xcode completely.
  6. Back in finder, delete all the contents INSIDE the ‘DerivedData’ folder. Do not delete the folder itself.
  7. Re-open Xcode and try rebuilding your app.

Hope this helps

Hi @toblerpwn i didn’t use the react-native-git-upgrade used rn-diff-purge instead. If you upgrading from 0.57.8 here is link to compare: 0.57.8-to-0.58.3 Difference not that much you could make changes yourself less than 10 minutes. After that:

  1. Clear under /RNApp/ios/build/ folder
  2. Then run:
$ rm -rf node_modules && npm install
$ react-native run-ios -- --reset-cache

Hope this helps you.

Share

Before upgrade to 0.58.1 (My RN: 0.57.7)

  • Backup your /ios/ or rename to /ios_old/ (as you like)

react-native eject react-native-git-upgrade react-native link

After linked

  • Compare all *.plist between /ios/ and /ios_old/ and cover the new one

react-native run-ios

  • Done

I can run perfect now, in /ReactCommon/ folder still missing /privatedata/. 😢

For anyone who’s still searching for a solution after trying all those above.

I resolved doing this: cd node_modules/react-native && scripts/ios-install-third-party.sh && cd third-party/glog-0.3.5/ && ../../scripts/ios-configure-glog.sh

I am also having this issue after react-native-git-upgrade; the steps above did not work for a RELEASE archive, but they do for a DEBUG archive, fwiw (different schemes in Xcode). I suspect the problem could be therein (perhaps some Xcode tomfoolery that was not resolved correctly by the upgrade command line tool).

Here are my “cleaning” steps (which did not fix the problem):

watchman watch-del-all
rm -rf $TMPDIR/react-*
rm -rf $TMPDIR/metro-*
rm -rf $TMPDIR/haste-*
rm -rf node_modules/
npm cache clean --force
rm -rf ios/Pods
rm -rf ios/build
rm -rf android/build

npm install
pod install
npm start -- --reset-cache

I am reverting back to 0.57.8 for now. I’ll try to get back on 0.58.x at some point using a different upgrade path!

I was having issues in iOS after upgrading from 0.56 to 0.59.5~. I was getting different errors between the CLI and Xcode 10, which eventually pointed towards JavaScriptCore (JSC) (which makes sense given 0.59 and JSC breaking changes). My “final boss” on the upgrade problem-set that de-clogged the iOS system is described via the following set of steps I wrote here:

https://stackoverflow.com/questions/50562596/library-not-found-for-ldoubleconversion/55776414#55776414

I was able to fix it by blowing out the ios/build folder, deleting Podfile.lock (with specific problem with Folly (and loosely related was glog but there were some red herring debug pathways there), upgrading cocoapods seemed to fix the problem caused by React Native trying to rely on stale packages where syntax was probably different, or where JSC-critical API was missing.

After that, I now boil it down to some caching/lock problem stemming from breaking changes in RN 0.57 to -0.59 caused by React Native baking in JSC. If you are having issues upgrading to around RN 0.59, you will most likely find that you need to remove android/build and ios/build folders and focus a bit on refreshing every part of the build system that might be relying on old files.

Here is a rough checklist to get your mind flowing:

  • kill metro bundler, and use npm start -- --reset-cache
  • remove your iOS app off the simulator
  • remove your Android app off the simulator
  • turn off and/or restart your simulators as you upgrade because they might be using something like iPhone 6 or 8 while the RN config is trying to use iPhone X (that might generate weird errors for you)
  • you may encounter issues with Google Play Services and stuff like that as you update your project to handle JSC
  • you might have issues with Android SDK and Gradle if you upgraded them (they change a bit from 0.56 to 0.59 as can be checked here in the diffs: https://github.com/react-native-community/rn-diff-purge)
  • start with a working RN version that allows you to build all your app’s third party dependencies on the simulator and preferably to make APK/IPA releases also (just so you know where it was working)
  • add the diffs as shown in that above URL, upgrade manually one version at a time and at least periodically check your simulators to make sure the app is still working
  • I encountered a lot of issues going from 0.56 to 0.57 or 0.58 because my Android/gradle stuff changed a lot and broke my release builds via cd android && ./gradlew assembleRelease
  • iOS seemed to have issues around 0.58 to 0.59 and especially for me because I am using react-native-maps which generated all kinds of issues as JSC config files were changed to support 64bit CPU architectures and RN 0.59; some third party dependencies seemed to really have an issue with that if their versions were locked in and stale because they weren’t supporting JSC.

If you discover your issues sound similar to mine and you learned about anything I didn’t describe, feel free to include a comment and describe a bit about how it relates to JSC and what you did to fix it. This will help others in the future that find this thread while Googling.

I was having the same error /node_modules/react-native/ReactCommon/privatedata/PrivateDataBase.h: No such file or directory and this is how I fixed it.

  1. In the top menu, open ‘Product’ and click ‘Clean Build Folder’.
  2. Open Xcode ‘Preferences’ and navigate to the ‘Locations’ tab on the top right.
  3. Under the ‘Derived Data’ input, there is a path in grey text and an arrow icon next to it. Click the arrow icon.
  4. This will take you to your DerivedData folder in finder.
  5. With this folder open, Quit Xcode completely.
  6. Back in finder, delete all the contents INSIDE the ‘DerivedData’ folder. Do not delete the folder itself.
  7. Re-open Xcode and try rebuilding your app.

Hope this helps

It works for me. Thanks!

If remove the folder ios/build that include some settings in info.plist sometimes.

So just remove the folder Build (the path is ios/build/Build)

then react-native run-ios will fix the problem.

That’s what I try. Hope it can helps others

@GoktuqCan I re-upgraded using rn-diff-purge, and yet I encountered the same problem!

I think the missing step for me was to actually open Xcode and clean the build folder using the Xcode menu (although I used cmd-option-K and cmd-K both). I got this idea by reading this comment on a related issue: https://github.com/facebook/react-native/issues/23183#issuecomment-458071519

image

I did also actually run the build from Xcode, too (prior to this I was only building RELEASE using fastlane). Perhaps simply running a release build from within Xcode un-cached something, too!