react-native-community / upgrade-support

A central community-backed place to request and give help when upgrading your app.
MIT License
254 stars 2 forks source link

FBReactNativeSpec error after upgrade from 0.63.4 to 0.64.0 #138

Closed ceyhunkeklik closed 2 years ago

ceyhunkeklik commented 3 years ago

Environment

System: OS: macOS 11.2.3 CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz Memory: 1.27 GB / 16.00 GB Shell: 5.8 - /usr/local/bin/zsh Binaries: Node: 12.18.0 - ~/.nvm/versions/node/v12.18.0/bin/node Yarn: 1.22.10 - ~/.nvm/versions/node/v12.18.0/bin/yarn npm: 6.14.5 - ~/.nvm/versions/node/v12.18.0/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.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 Android SDK: API Levels: 28, 29 Build Tools: 19.1.0, 20.0.0, 21.1.2, 22.0.1, 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1, 24.0.2, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.1, 27.0.2, 27.0.3, 28.0.0, 28.0.1, 28.0.2, 28.0.3, 29.0.2, 30.0.3 System Images: android-28 | Google APIs Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 4.1 AI-201.8743.12.41.7042882 Xcode: 12.4/12D4e - /usr/bin/xcodebuild Languages: Java: 1.8.0_281 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.1 => 17.0.1 react-native: 0.64.0 => 0.64.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Things I’ve done to figure out my issue

I used react-native cli to upgrade and the following page to manually changes. https://react-native-community.github.io/upgrade-helper/?from=0.63.4&to=0.64.0

Upgrading version

0.64.0

Description

I've faced the following error when I want to start the IOS app with the "react-native run-ios" command. If I start the debug build from XCode, it is started successfully.

/bin/sh -c /Users/keklikc/Library/Developer/Xcode/DerivedData/DataroidMobile-gmjqxfphavicwkcccsennxqbhvuj/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-0565B84ED1A643A94B66851B97B33BAC.sh nvm is not compatible with the "npm_config_prefix" environment variable: currently set to "/Users/keklikc/.nvm/versions/node/v12.18.0" Run unset npm_config_prefix to unset it. /Users/keklikc/.zshrc: line 83: zstyle: command not found /Users/keklikc/.zshrc: line 84: zstyle: command not found /Users/keklikc/.zshrc: line 85: zstyle: command not found /Users/keklikc/.oh-my-zsh/tools/check_for_upgrade.sh: line 32: syntax error near unexpected token )' /Users/keklikc/.oh-my-zsh/tools/check_for_upgrade.sh: line 32:() {' /Users/keklikc/.oh-my-zsh/oh-my-zsh.sh: line 21: autoload: command not found /Users/keklikc/.oh-my-zsh/oh-my-zsh.sh: line 39: syntax error near unexpected token (' /Users/keklikc/.oh-my-zsh/oh-my-zsh.sh: line 39:for plugin ($plugins); do' /Users/keklikc/.zshrc: line 120: autoload: command not found /Users/keklikc/.zshrc: line 129: add-zsh-hook: command not found nvm is not compatible with the "npm_config_prefix" environment variable: currently set to "/Users/keklikc/.nvm/versions/node/v12.18.0" Run unset npm_config_prefix to unset it. Command PhaseScriptExecution failed with a nonzero exit code

warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flipper-Glog' from project 'Pods') warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'boost-for-react-native' from project 'Pods') warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.4, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flipper-PeerTalk' from project 'Pods') warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'YogaKit' from project 'Pods') warning: no rule to process file '/Users/keklikc/Projects/Dataroid-MobileApp/ios/Pods/Flipper-RSocket/rsocket/README.md' of type 'net.daringfireball.markdown' for architecture 'x86_64' (in target 'Flipper-RSocket' from project 'Pods') warning: no rule to process file '/Users/keklikc/Projects/Dataroid-MobileApp/ios/Pods/Flipper-RSocket/rsocket/benchmarks/CMakeLists.txt' of type 'text' for architecture 'x86_64' (in target 'Flipper-RSocket' from project 'Pods') warning: no rule to process file '/Users/keklikc/Projects/Dataroid-MobileApp/ios/Pods/Flipper-RSocket/rsocket/benchmarks/README.md' of type 'net.daringfireball.markdown' for architecture 'x86_64' (in target 'Flipper-RSocket' from project 'Pods') warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flipper-DoubleConversion' from project 'Pods')

BUILD FAILED

The following build commands failed: PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/keklikc/Library/Developer/Xcode/DerivedData/DataroidMobile-gmjqxfphavicwkcccsennxqbhvuj/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-0565B84ED1A643A94B66851B97B33BAC.sh (1 failure)

Reproducible demo

Upgrade from 0.63.4 to 0.64.0 then execute react-native run-ios

renderlife commented 2 years ago

Maybe it will help since I had something similar and I found this question!

I was installing TheCodingMachine React Native boilerplate 3.2.5 link and I got a similar error.

Decision. Updated the React Native version

//react-native": "0.66.4" ->  "react-native": "0.67.3"

cd ios && rm -rf Pods && pod install

And an nvm update can also help.

amirmohammadshamss commented 2 years ago

my problem fixed by
nvm install 8.0.0 in react native. 0.67.2 Xcode 13 mac mac

yajinn commented 2 years ago

This must be a joke, because I used a space in the parent folder name and it got fixed when I remove

../React Native/project -> ../ReactNative/project

emil-malmgaard-rasmussen commented 2 years ago

Interesting. Had same issue after upgrading from 0.66 to 0.67. Tried everything, deleting & re-installing pods, re-installing node modules, alias etc. The only think to have worked in my case was changing -e to +e in node_modules/react-native/scripts/find-node.sh

This fixed it for me when upgrading from .63 to .67, I think it might just be an issue to upgrading .67 in general

This did it for me, not sure if it is a permanent fix though??

Would it be smartest to add nvm or is that also a conditional fix?

amirmohammadshamss commented 2 years ago

I changed the node.js version, and It was corrected.

mjmasn commented 2 years ago

Came across this issue after upgrading from 0.66.4 to 0.67.1.


First thing is to make sure react-native-codegen is installed. npm i -D react-native-codegen or yarn add --dev react-native-codegen


Secondly if the script still fails, changing -e to +e works but really this is just hiding the issue.

It looks like the line

[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"

in find-node.sh will always have a non-zero return code (at least in our case, NVM_DIR must already be defined) so this is triggering the script to exit early due to the -e flag.

A more robust solution is to change that line to:

if [[ -z "$NVM_DIR" ]]; then
  export NVM_DIR="$HOME/.nvm"
fi

that way the script will still exit on any genuine errors.

EDIT: This started failing again, this time seemingly in the actual ~/.nvm/nvm.sh script rather than in find-node.sh. I only have node via nvm so can't use the suggestion from @kulor below. I've gone back to the +e change instead which seems to work enough for the build process to locate node.

kulor commented 2 years ago

My fix, for now, is to clear the script. Not proud of it but progress over perfection when you're unblocking the build. Didn't like the idea of removing nvm or changing the desired version.

echo '' > node_modules/react-native/scripts/find-node.sh
ceyhunkeklik commented 2 years ago

I think this issue has many solutions to fix it. Therefore, I closing it.

ksealey commented 2 years ago

Recently ran into this issue. Downgrading npm to version 16.x worked for me. I use nvm, so nvm use 16 and voila.

kiki-le-singe commented 2 years ago

Hello,

I come back 😅

My precedent comment is here https://github.com/react-native-community/upgrade-support/issues/138#issuecomment-1032782312 ... But now it doesn't work anymore 😏

But I fix the issue like that, I just comment these lines in node_modules/react-native/scripts/find-node.sh file:

# Define NVM_DIR and source the nvm.sh setup script
# [ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"

# if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
#   . "$HOME/.nvm/nvm.sh"
# elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
#   . "$(brew --prefix nvm)/nvm.sh"
# fi

I think there is a problem with my nvm config so I use my node version from brew.

I hope it helps someone

iasimk commented 2 years ago

This must be a joke, because I used a space in the parent folder name and it got fixed when I remove

../React Native/project -> ../ReactNative/project

Worked for me 👯

dipakksharma commented 2 years ago

After two days of trying i found the solution in deleting spaces in the path where your project lives and run. But in order for this to work properly follow these steps:

  • If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues (i.e. npm uninstall -g react-native-cli)
  • Move the project folder in a path with no spaces (i.e. ~/sub folder name/ReactNativeApp won't work till you have spaces in the path, so move in a path like ~/folder/ReactNativeApp)
  • Then cd into the project folder and upgrade react native to the latest version with npx react-native upgrade and resolve conflicts if any
  • After upgrading remove the node_modules folder and the yarn.lock from the root and the podfile.lock and Pods folder from ios subfolder
  • Then cd back to the root and run yarn install && npx pod-install

Now run again your app in Xcode or your IDE and it works

Crazy and absurd that a space in the path-name could cause this issue

It's really working for me, Thank you so much !!! 😊

Danny7fold commented 2 years ago

I'm currently facing this issue mac os 12.5 xcode 13

Danny7fold commented 2 years ago

library not found for -lFBReactNativeSpec

ruhg12 commented 2 years ago

After two days of trying i found the solution in deleting spaces in the path where your project lives and run. But in order for this to work properly follow these steps:

  • If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues (i.e. npm uninstall -g react-native-cli)
  • Move the project folder in a path with no spaces (i.e. ~/sub folder name/ReactNativeApp won't work till you have spaces in the path, so move in a path like ~/folder/ReactNativeApp)
  • Then cd into the project folder and upgrade react native to the latest version with npx react-native upgrade and resolve conflicts if any
  • After upgrading remove the node_modules folder and the yarn.lock from the root and the podfile.lock and Pods folder from ios subfolder
  • Then cd back to the root and run yarn install && npx pod-install

Now run again your app in Xcode or your IDE and it works

Crazy and absurd that a space in the path-name could cause this issue

It's really working for me, Thank you so much !!! 😊

jfaq89 commented 2 years ago

Anyone else experiencing this on 0.69.4 ?

KiranLogiticiks commented 2 years ago

This must be a joke, because I used a space in the parent folder name and it got fixed when I remove ../React Native/project -> ../ReactNative/project

Also worked for me too. My project was in folder with name "React Native" now I changed to "ReactNative". Now the error disappear. Thank you........

pke commented 1 year ago

Still running into this when trying to patch a couple of react-native 0.66.3 files with yarn patch-package react-native. None of the solutions here worked.

lukeirvin commented 1 year ago

I've made a brand new project, running on react-native version 0.70.4 and I'm getting the RBReactNativeSpec error when trying to build to a device.

dennismunene commented 1 year ago

Setting the default alias for nvm to my current node version did the trick for me.

  1. Check current version of node currently in use by running nvm current (Mine was 'system')
  2. Set it as default alias nvm set alias default system
southxzx commented 1 year ago

This must be a joke, because I used a space in the parent folder name and it got fixed when I remove

../React Native/project -> ../ReactNative/project

Why does it take me so long to find this comment LOL. It's exactly my case

kamalmalaklife commented 1 year ago

I had the same issue, apparently, there was an update to xcode while the simulator is running so it was not updated to the latest iOS, while xcode was trying to build the project with latest params for latest simulator who was not updated. I forced close the simulator and re-run, everything worked fine.

oliver-platt commented 1 year ago

Still having this issue with React 71.5. It builds locally but I can't get it run in the CI. Have tried all of the above! Driving me crazy. Anyone else still struggling with this or has another solution?

Thanks!

nirmal98kumar commented 1 year ago

This must be a joke, because I used a space in the parent folder name and it got fixed when I remove

../React Native/project -> ../ReactNative/project

Cannot thank you enough , such a silly thing . I almost used same parent folder name

Deryan98 commented 1 year ago

I had the same issue FBReactNativeSpec failing on making the build. My specific case was that neither an init AwesomeProject to run a helloworld was lifting the ios project. Solved this checking the path with pwdcommand /Users/myuser/React Native/AwesomeProject my path included a folder with a space "React Native" just had to delete that space to set the path as follows: /Users/myuser/ReactNative/AwesomeProject then do all the stuff to lift ios in your RN project run

rm -rf node_modules yarn.lock package-lock.json ios/Podfile.lock ios/Pods && 
yarn && cd ios && pod install && cd ..

then open your Awesome.xcodeproj located on ios folder with Xcode run Product > Clean build folder then Product > build

MariuzM commented 1 year ago

I had the same issue FBReactNativeSpec failing on making the build. My specific case was that neither an init AwesomeProject to run a helloworld was lifting the ios project. Solved this checking the path with pwdcommand /Users/myuser/React Native/AwesomeProject my path included a folder with a space "React Native" just had to delete that space to set the path as follows: /Users/myuser/ReactNative/AwesomeProject then do all the stuff to lift ios in your RN project run

rm -rf node_modules yarn.lock package-lock.json ios/Podfile.lock ios/Pods && 
yarn && cd ios && pod install && cd ..

then open your Awesome.xcodeproj located on ios folder with Xcode run Product > Clean build folder then Product > build

This worked for me just dont have any spaces in your parent folder names

caesaragen commented 7 months ago

This must be a joke, because I used a space in the parent folder name and it got fixed when I remove

../React Native/project -> ../ReactNative/project

yep this worked for me, thanks.