callstack / react-native-builder-bob

👷‍♂️ Simple set of CLIs to scaffold and build React Native libraries for different targets
https://callstack.github.io/react-native-builder-bob/
2.75k stars 182 forks source link

Create library with 0.41.2 can't build ios example #643

Closed LuongTruong closed 2 hours ago

LuongTruong commented 3 days ago

Description

  1. Run cmd: npx create-react-native-library@0.41.2 RNExample
  2. Run cmd: yarn to install node_modules
  3. Run cmd: pod install to install Pods
  4. Open iOS project and press build

As a result, I receive the error message: "exited with status code 127"

Packages

Selected options

I created:

Link to repro

Create a new library using the version 0.41.2

Environment

System: OS: macOS 15.0 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 164.05 MB / 32.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.12.2 path: /usr/local/bin/node Yarn: version: 3.6.1 path: /usr/local/bin/yarn npm: version: 10.8.1 path: /usr/local/bin/npm Watchman: version: 2024.07.01.00 path: /usr/local/bin/watchman Managers: CocoaPods: version: 1.15.2 path: /usr/local/bin/pod SDKs: iOS SDK: Platforms:

mariojose96 commented 1 day ago

That's just the error code, the actual error log is in the Issues section by clicking on the error.

If you're only having these issues when building via Xcode, and can successfully build from the example folder with `npm build:ios' from the terminal, the following may help, assuming it's the same problem I had where Xcode can't find npx:

  1. In Xcode go to Product > Scheme > Edit Scheme
  2. Select the “Build” tab on the left
  3. In the “Pre-actions” and “Post-actions” sections, add the following line to set the correct path for npx: export PATH="$PATH:$(npm bin -g)"
  4. Try to build again
LuongTruong commented 1 day ago

Hello @mariojose96

I tried to run the build:ios in package.json but it runs like forever.

I follow your action but still receive the error

  1. In Xcode go to Product > Scheme > Edit Scheme
  2. Select the “Build” tab on the left
  3. In the “Pre-actions” and “Post-actions” sections, add the following line to set the correct path for npx: export PATH="$PATH:$(npm bin -g)
  4. Try to build again

Please take a look at the image for more information. I also select the error message, but there is no more information for me to investigate.

ios-error

mariojose96 commented 14 hours ago

Hey @LuongTruong , I can reproduce the empty log as well in a new react-native module project using this command: npx create-react-native-library@latest react-native-awesome-module. But changing the build settings as suggested above solved it for me.

There's a good chance that it's just not grabbing the global npx path for you. I can see above that your path would resolve to "/usr/local/bin". Just export to that path directly with this command export PATH="$PATH:/usr/local/bin".

Your build settings Pre-actions should now look like this:

Xcode Build Settings Pre Actions

Add export PATH="$PATH:/usr/local/bin" to Post-Actions too, just to be sure.

LuongTruong commented 2 hours ago

Hey @mariojose96 , thanks for the comment. It helps me to build the app successfully.

I am closing the ticket since the issue is resolved.