software-mansion / react-native-reanimated

React Native's Animated library reimplemented
https://docs.swmansion.com/react-native-reanimated/
MIT License
8.84k stars 1.29k forks source link

PhaseScriptExecution fails for Hermes Engine after install of react-native-reanimated #6333

Open mstohr1975 opened 1 month ago

mstohr1975 commented 1 month ago

Description

I've reproduced an issue, whenever I install with npm install react-native-reanimated, then reinstall the pods with cd ios && pod install && cd .. and build the app with npx react-native run-ios I run into an error on Hermes Engine:

PhaseScriptExecution [CP-User]\ [Hermes]\ Replace\ Hermes\ for\ the\ right\ configuration,\ if\ needed /Users//Library/Developer/Xcode/DerivedData/

/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/hermes-engine.build/Script-46EB2E0001CA80.sh (in target 'hermes-engine' from project 'Pods') (1 failure)

Same project before installing reanimated builds perfectly fine, I reproduced it a couple times. Any thoughts how to overcome this? Many thx

Steps to reproduce

  1. npm install react-native-reanimated
  2. cd ios && pod install && cd ..
  3. npx react-native run-ios

Snack or a link to a repository

happy to share later

Reanimated version

3.14.0

React Native version

0.73.6

Platforms

iOS

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

mstohr1975 commented 1 month ago

Hi there,

I've reproduced a simple example under https://github.com/mstohr1975/ReanimateTest. In effect, it is set up with the latest Salesforce Mobile SDK React Native vanilla TypeScript project from https://developer.salesforce.com/docs/platform/mobile-sdk/guide/react-native-intro.html which is located here: https://github.com/forcedotcom/SalesforceMobileSDK-Templates/tree/dev/ReactNativeTypeScriptTemplate.

  1. So, I've created the project with forcereact create --platform=ios --appname=ReanimateTest --packagename=com.test.reanimate --organization="Reanimate Inc." --outputdir=
  2. Then I've started the project to validate it builds properly with npx react-native run-ios
  3. Afterwards I've installed the reanimate package: npm install react-native-reanimated
  4. Added the plugin in vi ./node_modules/react-native/template/babel.config.js at the end with plugins: ['react-native-reanimated/plugin']
  5. Reinstalled the pods with cd ios && pod install && cd ..
  6. And then after the rebuild with npx react-native run-ios I get the mentioned error.

The following build commands failed: PhaseScriptExecution [CP-User]\ [Hermes]\ Replace\ Hermes\ for\ the\ right\ configuration,\ if\ needed /Users//Library/Developer/Xcode/DerivedData/ReanimateTest-cbxampfvgdijsheyaooblqxhwpyc/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/hermes-engine.build/Script-46EB2E0001C820.sh (in target 'hermes-engine' from project 'Pods') (1 failure)

mstohr1975 commented 1 month ago

Forgot one point, I've commented a post install in Podfile which generated another build error:

React native post install

react_native_post_install( installer, $config[:reactNativePath], :mac_catalyst_enabled => false )

It will generate following error when installing Pods with pod install:

Downloading dependencies Generating Pods project Setting USE_HERMES build settings Setting REACT_NATIVE build settings [!] An error occurred while processing the post-install hook of the Podfile.

no implicit conversion of nil into String

/Users/mstohr/Documents/ReanimateTest/node_modules/react-native/scripts/cocoapods/utils.rb:129:in join' /Users/mstohr/Documents/ReanimateTest/node_modules/react-native/scripts/cocoapods/utils.rb:129:inblock (2 levels) in set_node_modules_user_settings' /Users/mstohr/Documents/ReanimateTest/node_modules/react-native/scripts/cocoapods/utils.rb:128:in each' /Users/mstohr/Documents/ReanimateTest/node_modules/react-native/scripts/cocoapods/utils.rb:128:inblock in set_node_modules_user_settings' /Users/mstohr/Documents/ReanimateTest/node_modules/react-native/scripts/cocoapods/utils.rb:127:in each' /Users/mstohr/Documents/ReanimateTest/node_modules/react-native/scripts/cocoapods/utils.rb:127:inset_node_modules_user_settings' /Users/mstohr/Documents/ReanimateTest/node_modules/react-native/scripts/react_native_pods.rb:307:in react_native_post_install' /Users/mstohr/Documents/ReanimateTest/ios/Podfile:59:inblock (2 levels) in from_ruby' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/podfile.rb:196:in post_install!' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1013:inrun_podfile_post_install_hook' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1001:in block in run_podfile_post_install_hooks' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:149:inmessage' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1000:in run_podfile_post_install_hooks' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:337:inblock (2 levels) in create_and_save_projects' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in write!' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:336:inblock in create_and_save_projects' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:64:in section' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:315:increate_and_save_projects' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:307:in generate_pods_project' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:183:inintegrate' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:170:in install!' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/command/install.rb:52:inrun' /opt/homebrew/lib/ruby/gems/3.3.0/gems/claide-1.1.0/lib/claide/command.rb:334:in run' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/lib/cocoapods/command.rb:52:inrun' /opt/homebrew/lib/ruby/gems/3.3.0/gems/cocoapods-1.15.2/bin/pod:55:in <top (required)>' /usr/local/bin/pod:25:inload' /usr/local/bin/pod:25:in `

'

fredrifoUni commented 1 month ago

This usually fixes it for me:

  1. rm ios/.xcode.env.local
  2. pod install

If that still doesn't work, clear the derived data and rebuild

mstohr1975 commented 1 month ago

Thx, will check next days and get back to you

mstohr1975 commented 1 month ago

I tried it in different ways, but did not succeed.

First of all, I do not overcome the error when installing the pods given, I always have to comment following part in Podfile to prevent the error explained above. This only happens after I install the react-native-reanimated package

React native post install

react_native_post_install( installer, $config[:reactNativePath], :mac_catalyst_enabled => false )

But more importantly, I've cleaned cache for all pods and rebuild as follows:

  1. cd ios
  2. pod cache clean --all
  3. pod install
  4. rm .xcode.env.local
  5. cd ...
  6. npx react-native run-ios

And still get the same error message:

The following build commands failed: PhaseScriptExecution [CP-User]\ [Hermes]\ Replace\ Hermes\ for\ the\ right\ configuration,\ if\ needed /Users/mstohr/Library/Developer/Xcode/DerivedData/DautXpense-gfqjutltodrrgmftqbwaxdmozcdl/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/hermes-engine.build/Script-46EB2E0001CA80.sh (in target 'hermes-engine' from project 'Pods') (1 failure)

See GitHub repository after removing .xcode.env.local: https://github.com/mstohr1975/ReanimateTest

fredrifoUni commented 1 month ago

@mstohr1975 Did you try to delete the derived data folder? If not, I'm not sure what could be causing it Users/mstohr/Library/Developer/Xcode/DerivedData/

mstohr1975 commented 1 month ago

Ah, sorry, forgot to mention it...yes, I deleted the DerivedData folder. Same error...by the way, pod install will recreate the .xcode.env.local file...that's why I deleted it afterwards.

I also tried

rm -rf ~/Library/Developer/Xcode/DerivedData/ cd ios pod deintegrate pod update cd.. npm start or npx react-native run-ios

Still the same error...

mixnam commented 1 month ago

What is the config in your ios/.xcode.env.local ? Make sure that right path to node is specified in NODE_BINARY var. If it's not the right path to your actual node version, then just correct it manually. It worked for me

mstohr1975 commented 1 month ago

Many thanks. Let me check this coming week...I'll get back to you.

mstohr1975 commented 3 weeks ago

We validated the NODE_BINARY path directs to the latest node.js version: export NODE_BINARY=/usr/local/bin/node. That seems not the issue either. Thx for your help anyways.