React Native: Problem with dependencies and archiving my project

I have returned to a project which I haven't worked on in a little while. I added a delete account feature and planned to release it to the apple store that day.

I ran npm install --legacy-peer-deps && cd ios && pod install. This all worked fine (my packages are a little out of date since I haven't worked in this project for a while so I had to user legacy-peer-deps instead).

Next step, I went to XCode and tried to archive my project as usual but got a build failed with the error being Undefined symbol: _swift_stdlib_isStackAllocationSafe - after some research

I found a solution on this post: Symbol(s) not found for architecture arm64 - XCode

There was a really helpful approved answer. I added the suggested code to my podfile and tried to run npm install react-native-purchases@latest as suggested. BUT, I am presented with the following error:

React Native purchase error code

At this point I'm thinking hmmm conflicting dependency let me try to install with npm install react-native-firebase/app and then this shows me the next error.

enter image description here

I try to install babel-plugin-root-import and then it shows me the first image error again and repeats. I'm a bit stuck, I just want to get this project back up and running but its a pain!

Here's my package.json for reference:

{
  "scripts": {
    "start": "react-native start",
    "android": "npx react-native run-android",
    "ios": "npx react-native run-ios --simulator='iPhone 13'",
    "start:development": "NODE_ENV=development npx react-native start",
    "start:production": "NODE_ENV=production npx react-native start"
  },
  "dependencies": {
    "@fawazahmed/react-native-read-more": "^2.2.2",
    "@invertase/react-native-apple-authentication": "^2.1.0",
    "@react-native-community/async-storage": "^1.12.1",
    "@react-native-community/blur": "^3.6.0",
    "@react-native-community/google-signin": "^5.0.0",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/slider": "^3.0.3",
    "@react-native-firebase/app": "^13.0.1",
    "@react-native-firebase/auth": "^14.2.1",
    "@react-native-firebase/firestore": "^10.5.1",
    "@react-native-firebase/storage": "^13.0.1",
    "@react-navigation/bottom-tabs": "^5.11.7",
    "@react-navigation/native": "^5.9.2",
    "@react-navigation/stack": "^5.14.2",
    "expo": "~40.0.0",
    "expo-app-loading": "^1.0.1",
    "expo-apple-authentication": "~2.2.2",
    "expo-google-app-auth": "^8.1.4",
    "expo-google-sign-in": "~8.4.0",
    "expo-linear-gradient": "~8.4.0",
    "expo-notifications": "~0.8.2",
    "expo-splash-screen": "~0.8.0",
    "expo-status-bar": "~1.0.3",
    "expo-updates": "~0.4.0",
    "firebase": "^8.2.5",
    "lottie-react-native": "^4.0.2",
    "react": "16.13.1",
    "react-apple-signin-auth": "^0.0.7",
    "react-dom": "16.13.1",
    "react-native": "~0.63.4",
    "react-native-calendars": "^1.1254.0",
    "react-native-countdown-circle-timer": "^2.5.0",
    "react-native-device-info": "^8.0.7",
    "react-native-dotenv": "^3.3.1",
    "react-native-fast-image": "^8.5.11",
    "react-native-gesture-handler": "^1.9.0",
    "react-native-google-signin": "^2.1.1",
    "react-native-haptic-feedback": "^1.11.0",
    "react-native-input-scroll-view": "^1.11.0",
    "react-native-keep-awake": "^4.0.0",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-parallax-header": "^1.1.4",
    "react-native-purchases": "^4.1.1",
    "react-native-reanimated": "^1.13.2",
    "react-native-responsive-screen": "^1.4.2",
    "react-native-safe-area-context": "^3.1.9",
    "react-native-screens": "^2.17.1",
    "react-native-sound": "^0.11.1",
    "react-native-svg": "12.1.0",
    "react-native-unimodules": "~0.12.0",
    "react-native-web": "~0.13.12",
    "react-navigation": "^4.4.3",
    "use-sound": "^2.0.1"
  },
  "devDependencies": {
    "@babel/core": "~7.9.0",
    "babel-jest": "~25.2.6",
    "babel-plugin-root-import": "^6.6.0",
    "eslint-import-resolver-babel-plugin-root-import": "^1.1.1",
    "jest": "~25.2.6",
    "metro-react-native-babel-preset": "^0.66.2",
    "prettier": "2.6.2",
    "react-test-renderer": "~16.13.1"
  },
  "private": true,
  "name": "Flexeee-RN",
  "version": "1.0.0"
}

PODFILE:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

$FirebaseSDKVersion = '8.9.0'

platform :ios, '11.0'

target 'FlexeeeRN' do
  use_unimodules!
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  # Uncomment the code below to enable Flipper.
  #
  # You should not install Flipper in CI environments when creating release
  # builds, this will lead to significantly slower build times.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work.
  #
  #  use_flipper!
  #  post_install do |installer|
  #    flipper_post_install(installer)
  #  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
   target.build_configurations.each do |config|
    config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
   end
  end
 end

 post_install do |installer|
    react_native_post_install(installer)
    fix_library_search_paths(installer)
  end
end

def fix_library_search_paths(installer)
  def fix_config(config)
    lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
    if lib_search_paths
      if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
        # $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1)
        # since the libraries there are only built for x86_64 and i386.
        lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
        lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
        if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
          # however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
          lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
        end
      end
    end
  end

  projects = installer.aggregate_targets
    .map{ |t| t.user_project }
    .uniq{ |p| p.path }
    .push(installer.pods_project)

  projects.each do |project|
    project.build_configurations.each do |config|
      fix_config(config)
    end
    project.native_targets.each do |target|
      target.build_configurations.each do |config|
        fix_config(config)
      end
    end
    project.save()
  end
end

Any help is appreciated. Thanks for your time.

UPDATE: I did npm install react-native-purchases@latest --legacy-peer-deps as suggested below (seems to have worked). But now, when I run pod install it doesn't like the code I added into the Podfile and says:

[!] Invalid Podfile file: syntax error, unexpected end, expecting end-of-input.

 #  from /Users/jacksaunders/Flexeee-V2/ios/Podfile:40
 #  -------------------------------------------
 #    end
 >  end
 #  
 #  -------------------------------------------

I've double checked the code I've added and its the exact same. Unsure, what to do from here.



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation