facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.51k stars 24.37k forks source link

[iOS Archive fails] - main.jsbundle does not exist. This must be a bug with #47285

Open mare95 opened 1 month ago

mare95 commented 1 month ago

Description

After bumping react native to v0.75.4 and few other dependencies xCode Archive started failing.

Note that building and running the app locally works as expected both for iOS and Android only Archive fails at the very end.

Any info on how to resolve this issue is much appreciated

Steps to reproduce

These are the basic steps i followed:

  1. installed new deps with yarn install
  2. updated pods cd ./ios && pod update
  3. opened app in the xCode and cleaned build folder Product > Clean build folder
  4. run archive Product > Archive

=> Archive fails at the very end with the error that is attached

Note that i tried deleting DerivedData, clearing yarn and pod cache but that didn't work.

React Native Version

0.75.4

Affected Platforms

Build - MacOS

Output of npx react-native info

System:
  OS: macOS 15.0.1
  CPU: (8) arm64 Apple M2
  Memory: 579.42 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.16.0
    path: ~/.nvm/versions/node/v18.16.0/bin/node
  Yarn:
    version: 3.6.4
    path: ~/.nvm/versions/node/v18.16.0/bin/yarn
  npm:
    version: 9.5.1
    path: ~/.nvm/versions/node/v18.16.0/bin/npm
  Watchman:
    version: 2024.09.23.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.0
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK:
    API Levels:
      - "23"
      - "26"
      - "28"
      - "29"
      - "30"
      - "31"
      - "33"
      - "34"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-29 | Intel x86 Atom_64
      - android-29 | Google APIs Intel x86 Atom
      - android-31 | Google APIs ARM 64 v8a
    Android NDK: 22.1.7171670
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12483815
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

...
+ BUNDLE_FILE='/Users/mare/Library/Developer/Xcode/DerivedData/poinz-dtpcuftlecxslseauzgegprszakv/Build/Intermediates.noindex/ArchiveIntermediates/poinz Test/BuildProductsPath/Test-iphoneos/poinz.app/main.jsbundle'
+ node /Users/mare/Desktop/projects_new/poinz-app/node_modules/react-native/local-cli/cli.js bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output '/Users/mare/Library/Developer/Xcode/DerivedData/poinz-dtpcuftlecxslseauzgegprszakv/Build/Intermediates.noindex/ArchiveIntermediates/poinz Test/BuildProductsPath/Test-iphoneos/poinz.app/main.jsbundle' --assets-dest '/Users/mare/Library/Developer/Xcode/DerivedData/poinz-dtpcuftlecxslseauzgegprszakv/Build/Intermediates.noindex/ArchiveIntermediates/poinz Test/BuildProductsPath/Test-iphoneos/poinz.app'
node:internal/modules/cjs/loader:1078
  throw err;
  ^

Error: Cannot find module '/Users/mare/Desktop/projects_new/poinz-app/node_modules/react-native/local-cli/cli.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v18.16.0
+ cd /Users/mare/Desktop/projects_new/poinz-app/node_modules/react-native-schemes-manager/../..
+ node /Users/mare/Desktop/projects_new/poinz-app/node_modules/react-native-schemes-manager/index.js hide-library-schemes
Hiding schemes from node_modules xcode projects.
 - [hide-library-schemes]: node_modules/react-native-haptic/ios/ReactNativeHaptic.xcodeproj/xcuserdata/charlesvinette.xcuserdatad/xcschemes skipped
+ [[ false != true ]]
+ [[ ! -f /Users/mare/Library/Developer/Xcode/DerivedData/poinz-dtpcuftlecxslseauzgegprszakv/Build/Intermediates.noindex/ArchiveIntermediates/poinz Test/BuildProductsPath/Test-iphoneos/poinz.app/main.jsbundle ]]
+ echo 'error: File /Users/mare/Library/Developer/Xcode/DerivedData/poinz-dtpcuftlecxslseauzgegprszakv/Build/Intermediates.noindex/ArchiveIntermediates/poinz Test/BuildProductsPath/Test-iphoneos/poinz.app/main.jsbundle does not exist. This must be a bug with'
error: File /Users/mare/Library/Developer/Xcode/DerivedData/poinz-dtpcuftlecxslseauzgegprszakv/Build/Intermediates.noindex/ArchiveIntermediates/poinz Test/BuildProductsPath/Test-iphoneos/poinz.app/main.jsbundle does not exist. This must be a bug with
+ echo 'React Native, please report it here: https://github.com/facebook/react-native/issues'
React Native, please report it here: https://github.com/facebook/react-native/issues
+ exit 2

Reproducer

This happens in my personal project

Screenshots and Videos

No response

react-native-bot commented 1 month ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
react-native-bot commented 1 month ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
cortinico commented 1 month ago

This happens in my personal project

Could you provide a repro?

mCzolko commented 1 month ago

I have similar issue when archive never finishes image I've seen something similar here: https://github.com/facebook/react-native/issues/46352

JedrekDabrowski commented 1 month ago

@mare95 it could be issue with xCode 16 not with rn 0.75

jeffngugi commented 3 weeks ago

I also faced the same issue after upgrading react native project

I use this command to make main.jsbundle "build-ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'"

After, I add it in Bundle Resources in build phases in xCode

Screenshot 2024-11-05 at 12 14 51