facebook / react-native

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

IOS archive build failed #35995

Closed savancodexive closed 1 year ago

savancodexive commented 1 year ago

Description

echo 'error: File /Users/csmac/Library/Developer/Xcode/DerivedData/CatholicHerald-gpksuwnluqifpdeogbpojpmdtoze/Build/Intermediates.noindex/ArchiveIntermediates/CatholicHerald/BuildProductsPath/Release-iphoneos/CatholicHerald.app/main.jsbundle does not exist. This must be a bug with React Native, please report it here: https://github.com/facebook/react-native/issues'

image

Version

0.70.1

Output of npx react-native info

System: OS: macOS 13.1 CPU: (8) arm64 Apple M1 Memory: 75.30 MB / 8.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 19.4.0 - /opt/homebrew/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.2.0 - /opt/homebrew/bin/npm Watchman: 2023.01.23.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /Users/csmac/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9123335 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 11.0.18 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.1 => 0.70.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

Click on Product -> Archive

Snack, code example, screenshot, or link to a repository

{ "name": "CatholicHerald", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint ." }, "dependencies": { "@react-native-async-storage/async-storage": "^1.17.11", "@react-native-community/netinfo": "^9.3.0", "@react-native-community/push-notification-ios": "^1.10.1", "@react-native-masked-view/masked-view": "^0.2.7", "@react-navigation/drawer": "^6.5.0", "@react-navigation/native": "^6.0.13", "@react-navigation/native-stack": "^6.9.0", "@react-navigation/stack": "^6.3.0", "axios": "^0.27.2", "html-to-text": "^9.0.3", "lodash": "^4.17.21", "lodash.memoize": "^4.1.2", "moment": "^2.29.4", "react": "18.1.0", "react-native": "0.70.1", "react-native-autoheight-webview": "^1.6.5", "react-native-config": "^1.4.12", "react-native-gesture-handler": "^2.6.1", "react-native-google-mobile-ads": "^9.1.0", "react-native-keyboard-aware-scroll-view": "^0.9.5", "react-native-linear-gradient": "^2.6.2", "react-native-localization": "^2.3.1", "react-native-localize": "^2.2.3", "react-native-onesignal": "^4.5.0", "react-native-reanimated": "^2.10.0", "react-native-render-html": "^6.3.4", "react-native-safe-area-context": "^4.3.4", "react-native-screens": "^3.17.0", "react-native-share": "^8.1.0", "react-native-skeleton-placeholder": "^5.2.4", "react-native-svg": "^13.7.0", "react-native-vector-icons": "^9.2.0", "react-native-video": "^5.2.1", "react-native-video-player": "^0.14.0", "react-native-virtualized-view": "^1.0.0", "react-native-webview": "^11.26.0", "react-native-youtube": "^2.0.2", "react-redux": "^8.0.4", "reactotron-react-native": "^5.0.3", "redux": "^4.2.0", "redux-logger": "^3.0.6", "redux-thunk": "^2.4.1" }, "devDependencies": { "@babel/core": "^7.12.9", "@babel/runtime": "^7.12.5", "@react-native-community/eslint-config": "^2.0.0", "babel-jest": "^26.6.3", "deprecated-react-native-prop-types": "^4.0.0", "eslint": "^7.32.0", "jest": "^26.6.3", "metro-react-native-babel-preset": "^0.72.1", "react-native-svg-transformer": "^1.0.0", "react-test-renderer": "18.1.0" }, "jest": { "preset": "react-native" } }

savancodexive commented 1 year ago

Solution: Please follow the below steps

Step 1: : Open the package.json file and add the following line

"build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/{project_folder_name}/main.jsbundle' --dev=false --platform='ios'"

{project_folder_name} : please replace this with your project name like as screenshot

image

Step 2 : run the below command for creating main.jsbundle file yarn build:ios or npm run build:ios

Step 3: Please add main.jsbundle in Copy Bundle Resources

Select -> Target → Build Phases under Copy Bundle Resources click on the plus button as the following screenshot.

image

Step 4 : Please select any ios device option image

Step 5: Now you can create archive build

jaexplorer commented 1 year ago

This didn't work for me, any ideas of why this is occuring?

savithrielangovan commented 1 year ago

Solution: Please follow the below steps

Step 1: : Open the package.json file and add the following line

"build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/{project_folder_name}/main.jsbundle' --dev=false --platform='ios'"

{project_folder_name} : please replace this with your project name like as screenshot

image

Step 2 : run the below command for creating main.jsbundle file yarn build:ios or npm run build:ios

Step 3: Please add main.jsbundle in Copy Bundle Resources

Select -> Target → Build Phases under Copy Bundle Resources click on the plus button as the following screenshot.

image

Step 4 : Please select any ios device option image

Step 5: Now you can create archive build

not working for . local images are not showing ? why its coming any idea