upgrade-support icon indicating copy to clipboard operation
upgrade-support copied to clipboard

FBReactNativeSpec error 0.66.4 => 0.67.1

Open eliw00d opened this issue 3 years ago • 5 comments

Environment

System:
    OS: macOS 11.6.2
    CPU: (12) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz
    Memory: 13.14 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.2 - /private/var/folders/cz/2n8j37mx5m77dx0_syhlx1g40000gp/T/xfs-2f1852ae/node
    Yarn: 3.0.2 - /private/var/folders/cz/2n8j37mx5m77dx0_syhlx1g40000gp/T/xfs-2f1852ae/yarn
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.2/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
    Android SDK:
      API Levels: 28, 30
      Build Tools: 30.0.2
      Android NDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /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

Things I’ve done to figure out my issue

Upgrading version

0.67.1

Description

I get the following error after upgrading:

▸ Running script '[CP-User] Generate Specs'
** ARCHIVE FAILED **


The following build commands failed:
	PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/svbuildmobile/Library/Developer/Xcode/DerivedData/StudioConnect-ggofkgtyftlqibgjicctklbogvej/Build/Intermediates.noindex/ArchiveIntermediates/StudioConnect/IntermediateBuildFilesPath/Pods.build/Beta-iphoneos/FBReactNativeSpec.build/Script-429B47FC19FFF8F5F1F45069D433D1A9.sh (in target 'FBReactNativeSpec' from project 'Pods')
(1 failure)
[14:34:10]: Exit status: 65

Reproducible demo

Is there any way to add additional logging around FBReactNativeSpec to see why it fails?

eliw00d avatar Jan 20 '22 20:01 eliw00d

run "nvm unalias default", it fixed it for me.

mozadeh avatar Jan 25 '22 03:01 mozadeh

Updating react-native/scripts/find-node.sh with the following patch fixed it for me:

diff --git a/node_modules/react-native/scripts/find-node.sh b/node_modules/react-native/scripts/find-node.sh
index 84e930a..77cd0d0 100755
--- a/node_modules/react-native/scripts/find-node.sh
+++ b/node_modules/react-native/scripts/find-node.sh
@@ -19,12 +19,16 @@ fi
 # Define NVM_DIR and source the nvm.sh setup script
 [ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"

+# Source nvm with '--no-use' and then `nvm use` to respect .nvmrc
+# Patch https://github.com/facebook/react-native/pull/32955
 if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
   # shellcheck source=/dev/null
-  . "$HOME/.nvm/nvm.sh"
+  . "$HOME/.nvm/nvm.sh" --no-use
+  nvm use 2> /dev/null || nvm use default
 elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
   # shellcheck source=/dev/null
-  . "$(brew --prefix nvm)/nvm.sh"
+  . "$(brew --prefix nvm)/nvm.sh" --no-use
+  nvm use 2> /dev/null || nvm use default
 fi

 # Set up the nodenv node version manager if present

SMJ93 avatar Jan 27 '22 10:01 SMJ93

i get the same error upgrading from 0.66.1 -> 0.67.1. one thing i noticed though was that the error only happens the first time i run the project. if i do it again then it works. (i clear build files with react-native-clean-project. then i can get the first time error again)

however this doesnt feel quite ideal.

Adnan-Bacic avatar Jan 31 '22 08:01 Adnan-Bacic

I have the same error after upgrading from 0.66.3 to 0.67.1. Updating node from 14.18.1 to 16.13.2 fixed the issue at first.

But then after reinstalling node_modules and pods, for build to succeed I had to run:

nvm unalias default

and then again:

nvm alias default 16.13.2

because otherwise metro bundler wouldn't be able to locate the node version.

I still cannot make it work via Xcode to build straight to my device... CI pipeline with node set to 16.13.2 builds fine.

Downgrading back to 0.66.3 for now.

igorhart avatar Feb 01 '22 12:02 igorhart

i found the answer between a few threads.

i updated nvm like this person suggested:

https://github.com/react-native-community/upgrade-support/issues/138#issuecomment-1021429795

so i was on Node 14 and updated to Node 16 using nvm, so:

nvm install 16

which installed 16.

i then ran:

nvm use 16

which sets my node version to 16. but this doesnt seem to persist, and it would go back to 14.

i then ran:

nvm unalias default

like the above person suggested

i then ran:

nvm alias default node

as shown here:

https://github.com/react-native-community/upgrade-support/issues/138#issuecomment-1016266644 https://stackoverflow.com/a/31859164/12197001

and then my Node version was 16 and my builds works.

Adnan-Bacic avatar Feb 02 '22 13:02 Adnan-Bacic