upgrade-support: FBReactNativeSpec error after upgrade from 0.63.4 to 0.64.0
Environment
System: OS: macOS 11.2.3 CPU: (8) x64 Intel® Core™ 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
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 166
- Comments: 177 (1 by maintainers)
Links to this issue
Commits related to this issue
- Update Podfile.lock Based on https://github.com/react-native-community/upgrade-support/issues/138#issuecomment-808895860 's suggestion to run `npx pod-install` — committed to biasmedia/scrabble by 3ygun 3 years ago
- Add `unset npm_config_prefix` to the top of find-node.sh Fixes https://github.com/react-native-community/upgrade-support/issues/138#issuecomment-798788120 — committed to geraintwhite/react-native by geraintwhite 3 years ago
In case anyone wants to try a temporary fix that worked for me: I ended up commenting all lines inside
node_modules/react-native/scripts/find-node.sh
. It seems as if my node environment didn’t agree with this script. I could build and run my project on an actual device afterwards without any further issues.I added
unset PREFIX
(probablyunset npm_config_prefix
for OP) to the top ofnode_modules/react-native/scripts/find-node.sh
and that fixes the iOS build. If this works for you, try usingpatch-package
to make this change sticky.I was able to resolve this problem with node by the following commands:
brew uninstall yarn
npm install --global yarn
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:
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
“rm -rf ~/.nvm” fixed my problem
this resolved all of my issues:
nvm unalias default
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
adding the package manually fixed it for me.
yarn add --dev react-native-codegen
Anyone else experiencing this on 0.69.4 ?
Env
What allowed me to run IOS
nvm unalias default
Got the same thing trying to upgrade from 0.64.0-rc.3 to stable 0.64.0.
Nothing helps.
Xcode 12.4 Big Sur Intel Node 15
This fixed it for me. I’m on an Intel Mac, running MacOS Monterey (v12.1) and Xcode 13.2.1
Try
runningnvm unalias default
My System:
I did the following:
nvm unalias default
(Note: arch -x86_64 only for M1 Silicon)
Hi!
unset npm_config_prefix
works for me!This is my
node_modules/react-native/scripts/find-node.sh
file:I hope it could help someone…
This worked for me.
Fixed my environment by doing this:
Commands I used:
I resolved it deleting scripts in XCode. Be careful if you do it too, because it may break something if you are using it: https://www.bswen.com/2021/04/others-ios-how-to-solve-Command-PhaseScriptExecution-failed-with-a-nonzero-exit-code.html
Facing same issue. Tried using
unset PREFIX
orunset npm_config_prefix
to the top ofnode_modules/react-native/scripts/find-node.sh
but no luck.This worked for me https://github.com/facebook/react-native/issues/31180#issuecomment-822069355
Run: "yarn add --dev react-native-codegen" and rebuild IOS project
@marudy - the issue with TurboModulesRegistry is actually a different issue - I ran into it too:
https://github.com/react-native-community/upgrade-support/issues/139
The error happens if you use the wrong version of node. Try making sure you are using node 12.0.
For me(I’m Intel mac user), the error occurred after upgrading rn from 0.66 to 0.67, and
nvm alias default node
fixed it.For me the issue happened on the CI. At first I tried to change the nvm and node versions on those machines but without any success. As previous comments suggested, the fix was to commented/clear everything in
find-node.sh
script under the pathnode_modules/react-native/scripts/find-node.sh
.However the CI always install npm each time a PR is running for example… So I had to write a script which does it in the post install. Might help to others as well. Here is what I did:
package.json
add the following:Create
postinstall.js
file.Here is the basic code inside that file:
Hope it helps!
Try running
nvm unalias default
@brandonpearcy thank you for the patch, and could you please explain in plain simple english what
unset PREFIX
does?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
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:
I think there is a problem with my nvm config so I use my node version from brew.
I hope it helps someone
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.
Thanks! Running “nvm unalias default” worked for me!
This worked for me: https://stackoverflow.com/a/67035460/9360334
If you get the error “… generate-specs.sh: No such file or directory” it probably happens, because FBReactNativeSpec adds a new script that get’s updated when you run
pod-install
and uses hard coded paths afterwards.We have our
Pods
folder checked into the repo, so we usually don’t runpod install
, if there are no new dependencies. I realized, when I was debugging on the CI but saw my own local machine paths used there. A simplenpx pod-install
fixed the issue on CI.I guess this change breaks checking in
Pods
folder into the git repo. We will have to runnpx pod-install
now after repo checkout (locally and ci). I decided to add it to a postinstall script in npm.This is the only “solution” that works for me. Thanks @jeancatarina. Do you know why this happen?
Seems like 0.67.2 has fix for this
https://github.com/facebook/react-native/releases/tag/v0.67.2
Updating nvm fixed it for me. https://github.com/nvm-sh/nvm#installing-and-updating
I have a solution that works but is not permanent if you redo pod install 😔
In Xcode select Pods >>>FBReactNativeSpec >>> Build phases >>> Just move the CP-USER scripts before the Headers script.
When are you going to fix this?
it works man, it was the space
This same error also happens for peeps who have
node
installed through Homebrew on Apple Silicon. This complicates things since Homebrew on Apple Silicon never links to/usr/bin
or/usr/local/bin
. Instead,$PATH
is extended by executingeval "$(/opt/homebrew/bin/brew shellenv)"
in~/.zprofile
, which is not picked up by Xcode. I solved the issue in the following way:fix_fb_react_native_spec(installer)
like so:I tried all the methods in this issue but with no luck. Finally, I commented out the whole find-node.sh, and it works.
UPDATE: I solved the problem by uninstalling
yarn
andnode
from my mac, which was installed by using Homebrew. After that, I installednvm
and then installnode
BY USINGnvm
. IT’s WORKS! NEVER TRUST HOMEBREWInstall nodejs with nvm: https://heynode.com/tutorial/install-nodejs-locally-nvm
p.s. My OS version is MacOS Big Sur 11.2.3
this worked for me, because I was setting an aliases for my node version earlier
Thanks, saved my day!
worked for react-native run-ios still issue while building for device or Archive
Below patch-package fixed this issue
I had the same issue on my build server but not my dev machine and adding
unset npm_config_prefix
withpatch-package
solves it.Worked for me 👯
Using RN 0.67.2 here and what finally worked for me was updating nvm from 0.33 to 0.39.1. The above mentioned fix (https://github.com/facebook/react-native/commit/35bcf934b186e581d100d43e563044300759557f) did not help, it actually caused the breakage. I think the fix assumes everyone is running the latest nvm.
After upgrading from node v12.19.0 (not working) to v14.16.1 with these commands:
It’s works !
2nd command is important to set node in path for non interactive shell (XCode Script Phase are run in non interactive shell, so nvm/node settings from .bash_profile is not used !). For people not using nvm, make sure
/usr/local/bin/node
is pointing on your node install. Verify with/usr/local/bin/node --version
nvm unalias default
should fix “PREFIX” error with nvm (maybe clean previous node version links)any update on this? it blocks any fastlane/bitrise build
it works after upgrade my nvm version with brew upgrade nvm
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!
It’s really working for me, Thank you so much !!! 😊
This fixed it for me when upgrading from .63 to .67, I think it might just be an issue to upgrading .67 in general
rm -rf ~/Library/Developer/Xcode/DerivedData
+ctrl+k
in xcode helpedThis saves my day. Thanks.
this works for me
The problem is because you have the project created inside a folder with a name that contains spaces, example: “React Native”, rename your folder to “React-Native” and rerun the command
npx react-native run-ios
, that should be enough.When you execute the command
npx react-native run-ios
it may create a new folder for you, you must delete the folder that was generated automatically and keep the folder that you renamed at the beginning as “React-Native”. Once the automatically generated folder is deleted, run the command again:npx react-native run-ios
After trying the way to comment all lines inside find-node.sh, it seems just works for one project. So, I follow your idea. I clean the whole npm, node, nvm and then reinstall them. It works. I think the problem is coming from unclear npm nvm node installations too. If someone is looking for a solution of errors, highly recommend to try it. Don’t trust brew install if you are using OSX.
In my case it was an old version of node
7.5.0
being cashed in~/.nvm
andfind-node.sh
was pulling this old node version instead of new one fromn
.Here’s respective PR that’s not merged yet https://github.com/facebook/react-native/pull/30906
So just deleting old version fixed it.
Hey all,
I got this issue as well, but before trying the monkey patch fix, I investigated my node and npm environment. Turns out I had a goofy environment (I think from installing node at one point with Homebrew, then from an installer, etc). I fixed my environment issues and this exact error disappeared. So, my advice is ensure your node environment is clean, your PATH is clean, etc.
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.
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.I’m currently facing this issue mac os 12.5 xcode 13
This didn’t fix, but deleting CP-USER phase did. I took this workaround from here
Intel 2018 Mac, node 16 installed standalone (no nvm)
npx react-native init RNFBNativeSpecSTILLBorked --template react-native-template-typescript
workedXCode build and run within XCode works
npm run ios
failed with FBReactNativeSpec errors like the ones above…edited
find-node.sh
to include the unset statements andnpm run ios
works.Rearranging the build phase steps didn’t work for me. Literally a fresh install broken, for 3 releases now (I installed .66).
EDIT: I stated “no nvm installed” - however after closer inspection I discovered the path that is checked for an nvm installation actually exists, but my local
which nvm
command returned nothing. I forgot I installed it previously and it looks like the uninstall or some other process did not cleanly remove this hidden directory.So I removed the hidden directory (
rm -rf ~/.nvm
), removed the edits I made tofind-node.sh
, and re-rannpm run ios
and the build worked.Double check that you have the directory present. It may be there after all!
This worked for me on my Mac M1, but then it starting showing the same error again. I am currently using React-Native 0.66 alpha release 2. I had to change this line:
to this:
After tried all solutions referred here, removing the ios/Pods directory and pod install again resolved my issue
This solution worked for me. Thank you.
@ceyhunkeklik I do not think you were affected by the “space in the path” issue that seems to be related to
FBReactNativeSpec
though…If using
yarn
andnvm
, tryyarn config get prefix
undefined
, make note of it and then runyarn config delete prefix
That was the only thing that worked for me (aside from editing
node_modules/react-native/scripts/find-node.sh
). This was hard to find, since the build failed withand only way above in the build output (>100 unrelated rows) was the following telltale message. So also try searching the build output for e.g.
nvm is not compatible with
to identify what is causing the failure in your system.Holly…after two weeks researching, it works … it works. OMG. Thanks for million. Dude I’m about cryin.
just wanna say massive shoutout to @giuseppealbrizio and their solution!!! Thanks a million!
This issue was happening for us on our local Github Actions Mac agent. Even though we are using https://github.com/actions/setup-node to specify a Node Version (12.16.3), React Native is ignoring that version of Node and instead using whatever NVM is currently set to. I think that’s because of this script which gets run by generate-specs.sh during an iOS build phase.
So we had NVM installed on this machine and Node was set to Node 15. We downgraded it to Node 12 and the build passed. This isn’t ideal though because our Github Actions workflow is using one Node version via https://github.com/actions/setup-node to do
yarn install
, but then potentially a completely different Node version during the iOS build phases if our build agent happens to have NVM installed.I’m not sure React Native should even be meddling with the path to
node
? I’m thinking the find-node.sh script should be first checking ifnode
is on the current path before assuming you wanna use something else like NVM, or at least have a way to disable that find-node check. Otherwise it can affect CI servers without even realising it.as turned out the problem was a space in the project path. Interesting that previous version wasn’t be under this issue
could you solve it?
I have tried (unset npm_config_prefix) workaround but I am still getting this error and iOS build failed.
Trying to solve this issue with no luck.
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
pwd
command/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 runthen open your Awesome.xcodeproj located on ios folder with Xcode run Product > Clean build folder then Product > build
I deleted node_modules and re-ran
yarn install
thenpod install
in .\iosFor me it failed because I’m not using nvm anymore but there was still a
~/.nvm
directory in my home folder which thefind-node.sh
script was targeting. Removing the directory fixed the problem.Thank you! This saved me
I managed to fix this issue by installing the latest react-native-codegen version:
yarn add --dev react-native-codegen
or:
npm install --save-dev react-native-codegen
oh right, maybe. i have System Integrity Protection disabled
This happens to me if I try to install pods by typing pod install. I’m able to get the app to run without error if I use npx pod-install instead.
@devmindset-shaunvos Thank you! Running “nvm unalias default” worked for me!
This also worked for me. But first I uninstalled nvm and node entirely and reinstalled them with homebrew.
I managed to solve the issue by re-installing NVM and downgrading Node to 12.5 and it worked for me after a day of headaches…
This fixed it for me:
Reinstall node & nvm like explained here: https://jamesauble.medium.com/install-nvm-on-mac-with-brew-adb921fb92cc
Install older Node version (12.5 in my case) && use it
Install pods & build
🚀
In my case the solution was to switch from bash to zsh terminal
@ha-family thanks, it works for me
I had to upgrade with
It resolved my issue
Was upgrading from 0.61.4 to 0.64.0 and ran into a separate issue with FBReactNativeSpec. In case this helps other Googlers (as this is the first search result to show up):
Updating Podfile based on the guide below helped resolve the issue: https://react-native-community.github.io/upgrade-helper/?from=0.61.4&to=0.64.0
Mainly adding the lines below, and removing the individual podspecs:
Thank you so much @giuseppealbrizio after spending many days with this error I lost all hope and then your comment rescued me. Thanks a lot.
Thanks for pointing this out @giuseppealbrizio it fixed my issue
What’s more strange is that it works exactly the opposite in android. When
react-native run-android
, it works well but when built from android studio it can’t find the js bundler (the build is ok).