Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ios, new arch] RN 0.72.0rc5 : React-RCTAppDelegate => Command PhaseScriptExecution failed with a nonzero exit code #37762

Closed
ajpaulingalls opened this issue Jun 7, 2023 · 29 comments
Labels
Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@ajpaulingalls
Copy link
Contributor

ajpaulingalls commented Jun 7, 2023

Description

When you create a new app using the latest RC for 0.72 and then install pods for new architecture, then the xcode build will fail in React-RCTAppDelegate with Command PhaseScriptExecution failed with a nonzero exit code.

React Native Version

0.72.0.rc5

Output of npx react-native info

info Fetching system and libraries information...
System:
  OS: macOS 13.4
  CPU: (10) arm64 Apple M1 Max
  Memory: 3.59 GB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.2.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 9.6.6
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2023.05.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /Users/paulingalls/.rvm/gems/ruby-3.1.3/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.1 AI-221.6008.13.2211.9477386
  Xcode:
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.19
    path: /opt/homebrew/opt/openjdk@11/bin/javac
  Ruby:
    version: 3.1.3
    path: /Users/paulingalls/.rvm/rubies/ruby-3.1.3/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.0-rc.5
    wanted: 0.72.0-rc.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: true

Steps to reproduce

npx react-native@latest init RN0720RC5 --version 0.72.0-rc.5
cd RN0720RC5/ios
USE_HERMES=1 RCT_NEW_ARCH_ENABLED=1 pod install --repo-update

Open the xcode workspace and hit build.

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

You can just use the starter app with no code changes.

@ajpaulingalls ajpaulingalls added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Jun 7, 2023
@ajpaulingalls ajpaulingalls changed the title RN 0.72.0rc5 : React-RCTAppDelegate => Command PhaseScriptExecution failed with a nonzero exit code M1 Mac - RN 0.72.0rc5 : React-RCTAppDelegate => Command PhaseScriptExecution failed with a nonzero exit code Jun 7, 2023
@cortinico
Copy link
Contributor

Could you share your build log?

@ajpaulingalls
Copy link
Contributor Author

Here is the end of the log, let me know if you need the full thing....

/Users/paulingalls/src/playground/RN0720RC5/node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTImagePrimitivesConversions.h:67:30: 'stringByAddingPercentEscapesUsingEncoding:' is deprecated: first deprecated in iOS 9.0 - Use -stringByAddingPercentEncodingWithAllowedCharacters: instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid.

CompileC /Users/paulingalls/Library/Developer/Xcode/DerivedData/RN0720RC5-fxecseljtbwmckdotdktxizmqanw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-ImageManager.build/Objects-normal/arm64/RCTImageManager.o /Users/paulingalls/src/playground/RN0720RC5/node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTImageManager.mm normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-ImageManager' from project 'Pods')
    cd /Users/paulingalls/src/playground/RN0720RC5/ios/Pods
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c++ -ivfsstatcache /Users/paulingalls/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator16.4-20E238-.sdkstatcache -target arm64-apple-ios12.4-simulator -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=c++17 -stdlib\=libc++ -fobjc-arc -fmodules -fmodules-cache-path\=/Users/paulingalls/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/paulingalls/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -Wno-c++11-extensions -Wno-implicit-fallthrough -DPOD_CONFIGURATION_DEBUG\=1 -DDEBUG\=1 -DCOCOAPODS\=1 -DOBJC_OLD_DISPATCH_PROTOTYPES\=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -g -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -Wunguarded-availability -fobjc-abi-version\=2 -fobjc-legacy-dispatch -index-store-path /Users/paulingalls/Library/Developer/Xcode/DerivedData/RN0720RC5-fxecseljtbwmckdotdktxizmqanw/Index.noindex/DataStore -I/Users/paulingalls/Library/Developer/Xcode/DerivedData/RN0720RC5-fxecseljtbwmckdotdktxizmqanw/Build/Products/Debug-iphonesimulator/React-ImageManager/include -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Private -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Private/React-ImageManager -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/DoubleConversion -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/FBLazyVector -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/RCT-Folly -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/RCTRequired -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/RCTTypeSafety -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-Codegen -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-Core -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-Fabric -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-ImageManager -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-NativeModulesApple -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-callinvoker -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-cxxreact -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-debug -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-graphics -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-hermes -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-jsi -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-jsiexecutor -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-jsinspector -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-logger -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-perflogger -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-runtimeexecutor -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-runtimescheduler -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React-utils -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/ReactCommon -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/SocketRocket -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/Yoga -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/fmt -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/glog -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/hermes-engine -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/libevent -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/boost -I/Users/paulingalls/src/playground/RN0720RC5/node_modules/react-native/ReactCommon/react/renderer -I/Users/paulingalls/src/playground/RN0720RC5/node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios -I/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/RCT-Folly -I/Users/paulingalls/Library/Developer/Xcode/DerivedData/RN0720RC5-fxecseljtbwmckdotdktxizmqanw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-ImageManager.build/DerivedSources-normal/arm64 -I/Users/paulingalls/Library/Developer/Xcode/DerivedData/RN0720RC5-fxecseljtbwmckdotdktxizmqanw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-ImageManager.build/DerivedSources/arm64 -I/Users/paulingalls/Library/Developer/Xcode/DerivedData/RN0720RC5-fxecseljtbwmckdotdktxizmqanw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-ImageManager.build/DerivedSources -F/Users/paulingalls/Library/Developer/Xcode/DerivedData/RN0720RC5-fxecseljtbwmckdotdktxizmqanw/Build/Products/Debug-iphonesimulator/React-ImageManager -F/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/hermes-engine/destroot/Library/Frameworks/universal -F/Users/paulingalls/Library/Developer/Xcode/DerivedData/RN0720RC5-fxecseljtbwmckdotdktxizmqanw/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/hermes-engine/Pre-built -DRN_FABRIC_ENABLED -fmodule-map-file\=/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/RCTTypeSafety/RCTTypeSafety.modulemap -fmodule-map-file\=/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React/React-Core.modulemap -fmodule-map-file\=/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/ReactCommon/ReactCommon.modulemap -fmodule-map-file\=/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React_Codegen/React-Codegen.modulemap -fmodule-map-file\=/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/React_NativeModulesApple/React-NativeModulesApple.modulemap -fmodule-map-file\=/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/folly/RCT-Folly.modulemap -fmodule-map-file\=/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Headers/Public/yoga/Yoga.modulemap -DRN_FABRIC_ENABLED -DFOLLY_NO_CONFIG -DFOLLY_MOBILE\=1 -DFOLLY_USE_LIBCPP\=1 -Wno-comma -Wno-shorten-64-to-32 -Wno-documentation -include /Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Target\ Support\ Files/React-ImageManager/React-ImageManager-prefix.pch -MMD -MT dependencies -MF /Users/paulingalls/Library/Developer/Xcode/DerivedData/RN0720RC5-fxecseljtbwmckdotdktxizmqanw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-ImageManager.build/Objects-normal/arm64/RCTImageManager.d --serialize-diagnostics /Users/paulingalls/Library/Developer/Xcode/DerivedData/RN0720RC5-fxecseljtbwmckdotdktxizmqanw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-ImageManager.build/Objects-normal/arm64/RCTImageManager.dia -c /Users/paulingalls/src/playground/RN0720RC5/node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTImageManager.mm -o /Users/paulingalls/Library/Developer/Xcode/DerivedData/RN0720RC5-fxecseljtbwmckdotdktxizmqanw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-ImageManager.build/Objects-normal/arm64/RCTImageManager.o -index-unit-output-path /Pods.build/Debug-iphonesimulator/React-ImageManager.build/Objects-normal/arm64/RCTImageManager.o

In file included from /Users/paulingalls/src/playground/RN0720RC5/node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTImageManager.mm:19:
/Users/paulingalls/src/playground/RN0720RC5/node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTImagePrimitivesConversions.h:67:30: warning: 'stringByAddingPercentEscapesUsingEncoding:' is deprecated: first deprecated in iOS 9.0 - Use -stringByAddingPercentEncodingWithAllowedCharacters: instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid. [-Wdeprecated-declarations]
      urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
                             ^
In file included from <built-in>:1:
In file included from /Users/paulingalls/src/playground/RN0720RC5/ios/Pods/Target Support Files/React-ImageManager/React-ImageManager-prefix.pch:2:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:39:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSFileManager.h:11:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURL.h:605:1: note: 'stringByAddingPercentEscapesUsingEncoding:' has been explicitly marked deprecated here
- (nullable NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)enc API_DEPRECATED("Use -stringByAddingPercentEncodingWithAllowedCharacters: instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid.", macos(10.0,10.11), ios(2.0,9.0), watchos(2.0,2.0), tvos(9.0,9.0));
^
1 warning generated.

/Users/paulingalls/src/playground/RN0720RC5/node_modules/react-native/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTImagePrimitivesConversions.h:67:30: 'stringByAddingPercentEscapesUsingEncoding:' is deprecated: first deprecated in iOS 9.0 - Use -stringByAddingPercentEncodingWithAllowedCharacters: instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid.


Build target RN0720RC5 of project RN0720RC5 with configuration Debug
warning: Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RN0720RC5' from project 'RN0720RC5')
warning: Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'RN0720RC5' from project 'RN0720RC5')


Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase.

Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase.



Build failed    6/7/23, 12:00 PM    83.7 seconds

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Jun 8, 2023
@ajpaulingalls
Copy link
Contributor Author

Attached the full log just in case...
Build RN0720RC5_2023-06-07T11-59-13.txt

@cortinico
Copy link
Contributor

@cipolleschi @kelset ping if this is a release blocker or not

@kelset
Copy link
Contributor

kelset commented Jun 8, 2023

thanks for the report, I think that since it's new arch specific we might not consider it 0.72.0 release blocker but worth looking into

@kelset kelset changed the title M1 Mac - RN 0.72.0rc5 : React-RCTAppDelegate => Command PhaseScriptExecution failed with a nonzero exit code [ios, new arch] RN 0.72.0rc5 : React-RCTAppDelegate => Command PhaseScriptExecution failed with a nonzero exit code Jun 8, 2023
@ajpaulingalls
Copy link
Contributor Author

thanks for the report, I think that since it's new arch specific we might not consider it 0.72.0 release blocker but worth looking into

It does make using the new architecture basically impossible on a newer model mac...

@kelset
Copy link
Contributor

kelset commented Jun 8, 2023

I'm not saying we won't ever fix it - just that the fix can wait 0.72.1

@cipolleschi
Copy link
Contributor

Thanks @ajpaulingalls for the full log.

I'll look into this later today. I always test the new arch and last Thursday, when we released RC.5, it was working, so I'm a bit confused here.

We: have you also tried to disable Hermes? If yes, does the failure remain?

Nit: you don't need to use the USE_HERMES flag, as that's is the default! 😉

@cipolleschi
Copy link
Contributor

cipolleschi commented Jun 9, 2023

Just tried on my machine, and it works seamlessly, Apple M1 Pro.

The reason why it is failing on your specific machine is:

/Users/paulingalls/Library/Developer/Xcode/DerivedData/RN0720RC5-fxecseljtbwmckdotdktxizmqanw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-RCTAppDelegate.build/Script-46EB2E0001C5F0.sh: line 4:
/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/../../node_modules/react-native/scripts/codegen/generate-legacy-interop-components.js:
Permission denied
Command PhaseScriptExecution failed with a nonzero exit code

/Users/paulingalls/Library/Developer/Xcode/DerivedData/RN0720RC5-fxecseljtbwmckdotdktxizmqanw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-RCTAppDelegate.build/Script-46EB2E0001C5F0.sh: line 4:
/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/../../node_modules/react-native/scripts/codegen/generate-legacy-interop-components.js: 
Permission denied

Specifically:

/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/../../node_modules/react-native/scripts/codegen/generate-legacy-interop-components.js: 
Permission denied

This script tries to update a file in the React-RCTAppDelegate pod, the file is in the node_modules/react-native/Libraries/AppDelegate.
It's not clear why it would not have the required permissions. 🤔

@cortinico @kelset can I pick your brain too to brainstorm what may be going on? 🤔

@kelset
Copy link
Contributor

kelset commented Jun 9, 2023

good catch - it's probably something specific about the local configuration then.

The only thing that stands out to me of the config is Node 20... but that said I do have npm 9.7 installed and I can't repro either:
Screenshot 2023-06-09 at 14 31 54

@cortinico
Copy link
Contributor

/Users/paulingalls/src/playground/RN0720RC5/ios/Pods/../../node_modules/react-native/scripts/codegen/generate-legacy-interop-components.js:
Permission denied

This really feels a local issue to me. @ajpaulingalls could you try on a fresh setup, like in a different folder?

@cipolleschi
Copy link
Contributor

Actually, this #37802 could solve the issue.
@ajpaulingalls can you confirm that you are using the .xcode.env.local file?

@ajpaulingalls
Copy link
Contributor Author

OK, I dug into this some more.

tldr; I was installing watchman at roughly the same time with brew, and I'm guessing brew decided it would be a good idea to update my other packages, which included node. So even though node was there, I'm guessing it had problems launching.

I had previously been working on my intel mac with no problems, but moved to my m1 to make sure all was ok. I noticed I didn't have watchman, so I kicked off the install with brew, then updated my project and tried to pod install, resulting in the error. So I tried some more, googled around a bit, and overall couldn't find what was up. Then I tried with a clean project from init, with the same result so I filed the bug.

However, during this process watchman was still installing. I believe what happened was that brew decided to upgrade all of the other packages on my mac (is this the default now?). One of those packages was node. So even though node was there, I'm guessing it couldn't launch properly.

At any rate, when I try in a new folder today, the pod install works and the scripts run.

Sorry for the runaround. Appreciate all you guys do!

@memosize
Copy link

waitting to resovle

@cipolleschi
Copy link
Contributor

@memosize this has been solved already. Can you be more specific with your problem?

@memosize
Copy link

memosize commented Jun 30, 2023

@memosize this has been solved already. Can you be more specific with your problem?
here is my env
System:
OS: macOS 13.4
CPU: (8) x64 Apple M1
Memory: 20.41 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.14.0
path: ~/.nvm/versions/node/v18.14.0/bin/node
Yarn:
version: 1.22.19
path: ~/Documents/code-space/PetCommunity/node_modules/.bin/yarn
npm:
version: 9.3.1
path: ~/.nvm/versions/node/v18.14.0/bin/npm
Watchman:
version: 2023.04.10.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.11.3
path: /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 22.4
- iOS 16.4
- macOS 13.3
- tvOS 16.4
- watchOS 9.4
Android SDK: Not Found
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.10121639
Xcode:
version: 14.3.1/14E300c
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.11
path: /usr/bin/javac
Ruby:
version: 2.7.5
path: /Users/mikis/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.1
wanted: 0.72.1
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
even I upgrade to 0.72.1 still exist
I tried device and x86 and arm simulator

截屏2023-07-01 07 34 15

@birdofpreyru
Copy link
Contributor

birdofpreyru commented Jul 1, 2023

I've just bumped into this issue with RN@0.72.1

image

The Warning in the beginning of the screenshot makes me guess that it actually fails to detect the correct string for node executable command, gets an empty string instead of it, and thus instead of /path/to/node /path/to/generate-legacy-interop-components.js it runs just /path/to/generate-legacy-interop-components.js, where JS script is not meant to be an executable, does not have execute permissions, and that's why the error reads "Permission denied".

I actually have .xcode.env file in the project, with export NODE_BINARY=$(command -v node) command inside it, and command -v node returns me the correct path to node when I run it in my regular shell, but when that script is evaluated within XCode build, somehow I checked command -v node returns an empty string.

And... I am still using an Intel Mac, and I have Node installed via NVM, and it seems that something between NVM and XCode broke on my system, and it was highlighted by that script failing. The solution that works for me:

https://blog.nigelsim.org/2022-12-09-nvm-node-from-xcode/

@dppo
Copy link

dppo commented Jul 5, 2023

The same error occurred in the latest version(0.72.1) with RCT_NEW_ARCH_ENABLED=1

@saravana-mitrah
Copy link

I am facing the same issue in m1 mac

@cipolleschi
Copy link
Contributor

cipolleschi commented Jul 5, 2023

does it happens also if you put the actual path in the .xcode.env file?
so, instead of having

export NODE_BINARY=$(command -v node)

you actually have

export NODE_BINARY=~/somewhere/pointing/to/node/executable

basically, you can run command -v node in the terminal and paste the result after NODE_BINARY=

@birdofpreyru
Copy link
Contributor

@cipolleschi

does it happens also if you put the actual path in the .xcode.env file?

I guess it does not happen then; but it is a bad option, say for a public example app, which should work on other ppl's machine, who will have their node at different paths.

@cipolleschi
Copy link
Contributor

cipolleschi commented Jul 5, 2023

Yes, I should have added why I make this ask. 😅

  1. I wanted to unblock the contributor to go on with their work
  2. I wanted to make sure that that's the problem.
    Unfortunately, the way Xcode works is that it does not share the same env variable of the rest of the system.

So, even your system have node in the available executables, Xcode may not see it, and command -v node won't see it when run from an Xcode script phase, even if it finds it in your shell. :(
I'll need some time to look up what will be the best solution for this...

@dppo
Copy link

dppo commented Jul 5, 2023

does it happens also if you put the actual path in the .xcode.env file? so, instead of having

export NODE_BINARY=$(command -v node)

you actually have

export NODE_BINARY=~/somewhere/pointing/to/node/executable

basically, you can run command -v node in the terminal and paste the result after NODE_BINARY=

Following your steps, my machine is already functioning properly

@Dat-Mobile
Copy link

Dat-Mobile commented Jul 8, 2023

does it happens also if you put the actual path in the .xcode.env file? so, instead of having

export NODE_BINARY=$(command -v node)

you actually have

export NODE_BINARY=~/somewhere/pointing/to/node/executable

basically, you can run command -v node in the terminal and paste the result after NODE_BINARY=

Your solution works, thanks !!

But it leads to another question, why $(command -v node) is not working in the case

@cipolleschi
Copy link
Contributor

I haven't dug into it recently, but basically Xcode looks for env vars in specific paths.

Also, before each script exec, it export a bunch of environment variables, which can also clash with the current setup.

Unfortunately, it is kind of a known issue, you can find other people asking how to have Xcode recognise those variables online, but there is no clear explanation why it doesn't pick them up automatically. ☹️

@Dat-Mobile
Copy link

It's weird that when I disable New architecture, the node env path was picked correctly

@cipolleschi
Copy link
Contributor

Uhm... I don't think it does. When disabling the new architecture, that script is not executed as the interop layer is needed only for the new arch.
So it builds successfully because it doesn't have to use node.

@001bufanbin
Copy link

does it happens also if you put the actual path in the .xcode.env file? so, instead of having

export NODE_BINARY=$(command -v node)

you actually have

export NODE_BINARY=~/somewhere/pointing/to/node/executable

basically, you can run command -v node in the terminal and paste the result after NODE_BINARY=

Your solution works, thanks !!
I don't know the reason, it happened after I created a Turbo native module.

@anton-patrushev
Copy link

you should be also able to create .xcode.env.local along with existing .xcode.env and provide the real path to your node binary there. It should excluded from git by default.

  1. go to the ios folder from your CLI
cd ios
  1. create the .xcode.env.local file (it would ignored by git, so don't worry about exposing your local path to the remote repository 😅)
touch .xcode.env.local
  1. add the real node path to the .xcode.env.local file
echo export NODE_BINARY=$(command -v node) > .xcode.env.local

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests