react-native-web-monorepo icon indicating copy to clipboard operation
react-native-web-monorepo copied to clipboard

iOS release builds don't build

Open WookieFPV opened this issue 4 years ago • 6 comments

I tried to create an iOS release build.

Steps to reproduce:

  1. install pods
  2. open Xcode Workspace
  3. edit schema to release
  4. start build

Looks like the bundler doesn't know the "ios" platform => no bundle creation. "error Invalid platform "ios" selected"

+ node /Users/userName/RN-mono/node_modules/react-native/cli.js bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output /Users/userName/Library/Developer/Xcode/DerivedData/myprojectname-fkypvpelhfslakbkntpkeujauaii/Build/Products/Release-iphonesimulator/myprojectname.app/main.jsbundle --assets-dest /Users/userName/Library/Developer/Xcode/DerivedData/myprojectname-fkypvpelhfslakbkntpkeujauaii/Build/Products/Release-iphonesimulator/myprojectname.app
error Invalid platform "ios" selected.
info Available platforms are: "native". If you are trying to bundle for an out-of-tree platform, it may not be installed.
error Bundling failed. Run CLI with --verbose flag for more details.
Error: Bundling failed
    at buildBundle (/Users/userName/RN-mono/node_modules/@react-native-community/cli/build/commands/bundle/buildBundle.js:85:11)
    at async Command.handleAction (/Users/userName/RN-mono/node_modules/@react-native-community/cli/build/index.js:186:9)
+ [[ false != true ]]
+ [[ ! -f /Users/userName/Library/Developer/Xcode/DerivedData/myprojectname-fkypvpelhfslakbkntpkeujauaii/Build/Products/Release-iphonesimulator/myprojectname.app/main.jsbundle ]]
+ echo 'error: File /Users/userName/Library/Developer/Xcode/DerivedData/myprojectname-fkypvpelhfslakbkntpkeujauaii/Build/Products/Release-iphonesimulator/myprojectname.app/main.jsbundle does not exist. This must be a bug with'
error: File /Users/userName/Library/Developer/Xcode/DerivedData/myprojectname-fkypvpelhfslakbkntpkeujauaii/Build/Products/Release-iphonesimulator/myprojectname.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

iOS debug works fine.

react-native info
info Fetching system and libraries information...
System:
    OS: macOS 11.2.1
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 1.04 GB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.15.1 - /usr/local/bin/node
    Yarn: 1.22.5 - ~/.yarn/bin/yarn
    npm: 6.14.8 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 29, 30
      Build Tools: 29.0.1, 29.0.2, 29.0.3, 30.0.0, 30.0.2, 30.0.3
      System Images: android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
      Android NDK: 22.0.6917172-beta1
  IDEs:
    Android Studio: 4.1.2 4.1.2
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_275 - /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home//bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: Not Found
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

WookieFPV avatar Feb 15 '21 10:02 WookieFPV

facing similar issue. Not able to archive iOS build. Working fine in debug mode when I run from CLI or run from Xcode it works fine.

@WookieFPV @brunolemos if you guys can help would be great.

When I try to archive version to distribute facing issue. It is happening on this repo as well.

Xcode version: Version 12.2 node version: v15.2.1 "react": "17.0.1", "react-native": "0.64.0"

$react-native info System: OS: macOS 11.0.1 CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz Memory: 276.38 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 15.2.1 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.0.10 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.2, DriverKit 20.0, macOS 11.0, tvOS 14.2, watchOS 7.1 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: 12.2/12B45b - /usr/bin/xcodebuild Languages: Java: 1.8.0_271 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: Not Found react-native: Not Found react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found

**Error

+ DEST=/Users/user/Library/Developer/Xcode/DerivedData/myprojectname-auyxjuhjtndngvbiccxndsbjuqvw/Build/Intermediates.noindex/ArchiveIntermediates/myprojectname/BuildProductsPath/Release-iphoneos/myprojectname.app
+ [[ Release = *Debug* ]]
+ [[ -n '' ]]
+ case "$CONFIGURATION" in
+ DEV=false
+++ dirname ../../../node_modules/react-native/scripts/react-native-xcode.sh
++ cd ../../../node_modules/react-native/scripts/..
++ pwd
+ REACT_NATIVE_DIR=/Users/user/Work/RN/react-native-web-monorepo-master/node_modules/react-native
+ PROJECT_ROOT=/Users/user/Work/RN/react-native-web-monorepo-master/node_modules/react-native/../..
+ cd /Users/user/Work/RN/react-native-web-monorepo-master/node_modules/react-native/../..
+ [[ -n '' ]]
+ [[ -s index.ios.js ]]
+ ENTRY_FILE=index.js
+ [[ false != true ]]
+ [[ ! -f index.js ]]
+ echo 'error: Entry file index.js does not exist. If you use another file as your entry point, pass ENTRY_FILE=myindex.js'
error: Entry file index.js does not exist. If you use another file as your entry point, pass ENTRY_FILE=myindex.js
+ exit 2
`
```

devfsmalik avatar Apr 19 '21 10:04 devfsmalik

I am able to get it work using some hack. I have to update node_modules/react-native/scripts/react-native-xcode.sh

Updated PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../.."} to PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../../packages/mobile/"}

also will require to update ENTRY_FILE=${1:-index.js} to ENTRY_FILE=${1:-index.tsx}

I am not able to pass PROJECT_ROOT from "metro.config.js" so I have to use this hack.

devfsmalik avatar Apr 19 '21 13:04 devfsmalik

add a environment variable for react-native-xcode.sh will fix this promble. export PROJECT_ROOT=$PWD/..

1620583242648

Milker90 avatar May 09 '21 18:05 Milker90

add a environment variable for react-native-xcode.sh will fix this promble. export PROJECT_ROOT=$PWD/..

1620583242648

Thank you

wibb36 avatar Jun 11 '21 02:06 wibb36

Facing same error. Will try to add it later 👍

NilsBaumgartner1994 avatar Sep 04 '21 10:09 NilsBaumgartner1994

add a environment variable for react-native-xcode.sh will fix this promble. export PROJECT_ROOT=$PWD/..

1620583242648

This fixed the error 👍

NilsBaumgartner1994 avatar Sep 04 '21 14:09 NilsBaumgartner1994

I'm building it through xcode cloud and still getting the error. Where should I declare PWD env? Screenshot 2023-10-12 at 5 40 07 PM

Abhishek2250 avatar Oct 12 '23 12:10 Abhishek2250