react-native init causing build fail out of box - ios

Using react-native init <projectName>, then npm install results in a build fail with error :
Command /bin/sh failed with exit code 127
and message:
../node_modules/react-native/packager/react-native-xcode.sh: line 36: react-native: command not found
Command /bin/sh failed with exit code 127
Have installed react-native both locally, and globally to no avail.
Has anyone run into this issue and know how to solve?

The hack explained here works:
https://github.com/facebook/react-native/issues/3948
Add source ~/.bash_profile
to the beginning of react-native-xcode.sh
Apparently, fixed in 0.16.0-rc !
https://github.com/facebook/react-native/commit/9a64f17de84e50a4fc60f1b96168aa61925934a8

Related

Xcode script - xargs: python: No such file or directory - Command PhaseScriptExecution failed with a nonzero exit code

After updating to Xcode 13.3.1 and updating comand line tools I cannot build my project. I get error:
Command PhaseScriptExecution failed with a nonzero exit code
python -mjson.tool ./someFileName.json
xargs: python: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
The script that failes is:
python -mjson.tool "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/assets/someFileName.json"
It was working fine before. Even if I checkout at the commit that was working I still get the same message. This is why I suspect Xcode update.
Does anyone know how to solve this? What does the error mean? What does No such file or directory refer to? Is Python missing (cannot be found)? what is mjson.tool and is it missing? Is someFileName.json missing?
Any help is appreciated :)
Let me answer my own question here :)
MacOS 12.3.1 Monterey dropped support for Python 2 and it is removed from the OS. That is what
xargs: python: No such file or directory
was trying to say to me - python is missing. Fortunately Python 3 is installed and you can access it by calling python3 instead of just python.
Be ware because python2 code is not always runnable on Python3. Chances are you will need to fix (update) the code.
I was lucky and I managed to fix this just by replacing python with python3.
Alternatively you could try to install python2 by hand but this is not recommended.

React Native 0.64 Command PhaseScriptExecution failed with a nonzero exit code

I'm installing a new project with a bunch of modules with React Native 0.64. I can do a pod install without troubles, but when I want to make my app running (with react-native run-ios or with XCode) this error occured on XCode :
/Users/thomas/Desktop/Dev/Mobile/appname/node_modules/react-native/scripts/generate-specs.sh: line 27: readlink: command not found
/Users/thomas/Desktop/Dev/Mobile/appname/node_modules/react-native/scripts/generate-specs.sh: line 27: dirname: command not found
/Users/thomas/Desktop/Dev/Mobile/appname/node_modules/react-native/scripts/generate-specs.sh: line 27: cd: : No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code
This one on react-native run-ios :
The following build commands failed:
PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/thomas/Library/Developer/Xcode/DerivedData/appname-aqbmfgqjkshyqmaprdvggqaeqjrp/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/**FBReactNativeSpec**.build/Script-A319AA7F2B7AAE771AE63D66A0049241.sh
Note that I don't have a 'scripts' folder in my node_modules/react-native (I just have assets, normalize-color and polyfills folders). I've tried to remove node-modules and reinstall it.
My specs are :
iOS Big Sur v. 11.2.3
XCode v.12.3
React Native v.0.64
CocoaPods v. 1.10.1
Node v. 12.14.1
Any help ? Thanks.
I found the solution after hours of debugging you need to modify this file for now.
Edit this file /node_modules/react-native/React/FBReactNativeSpec/../../scripts/generate-specs.sh
Add this line export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
Then run the project using Xcode it will work 100%
The above answer is correct but in that case, you are editing the inside the node modules. So rather than just enter this command in your terminal
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin

Bazel doesn't build ios mediapipe examples

I tried to build HandTrackingExample and get this error
ERROR:
/Users/air/Documents/mediapipe/mediapipe/examples/ios/handtrackinggpu/BUILD:34:16:
ProcessEntitlementsFiles
mediapipe/examples/ios/handtrackinggpu/HandTrackingGpuApp_entitlements.entitlements
failed (Exit 1): plisttool failed: error executing command
bazel-out/host/bin/external/build_bazel_rules_apple/tools/plisttool/plisttool
... (remaining 1 argument(s) skipped)
Note: The failure of target
#build_bazel_rules_apple//tools/plisttool:plisttool (with exit code 1)
may have been caused by the fact that it is running under Python 2
instead of Python 3. Examine the error to determine if that appears to
be the problem. Since this target is built in the host configuration,
the only way to change its version is to set --host_force_python=PY3,
which affects the entire build.
If this error started occurring in Bazel 0.27 and later, it may be
because the Python toolchain now enforces that targets analyzed as PY2
and PY3 run under a Python 2 and Python 3 interpreter, respectively.
See https://github.com/bazelbuild/bazel/issues/7899 for more
information.
I tried build with --host_force_python=PY3 and PY2 but error the same
The link that is given in the error did not find a solution to your problem. How do I build a project correctly?
Try it
$ brew install python
$ sudo ln -s -f /usr/local/bin/python3.7 /usr/local/bin/python
$ python --version
Python 3.7.4
$ pip3 install --user six

ChicagoBoss failed to run on version OTP18.1

I am currently using newest erlang version otp/18.1 to run ChicagoBoss, but I see this error
ERROR: compile failed while processing /home/datumwiine/ChicagoBoss-0.8.15/deps/riak_pb: rebar_abort
What could be wrong?
Try typing in the command line the following commands:
git clone https://github.com/ChicagoBoss/ChicagoBoss.git
cd ChicagoBoss/
make

Xcode Compile Error

I'm repeatedly getting this error with my code using Xcode.
<unknown>:0: error: merge-module command failed with exit code 1 (use -v to see invocation)
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
I've tried everything I could find on how to fix the issue and nothing has worked. I've switched my optimization level to None[-Onone], I've performed cleans and I've run the xcodebuild function in Terminal, but nothing has worked. Any ideas on how to fix this issue?
I just had the same issue. I'm using Carthage and finally figured out that, for some reason, I had run carthage update with sudo which changed the permissions of the compiled frameworks. I fixed this by running the following commands.
brew upgrade carthage
sudo rm -rf Carthage/
carthage update
Then clean the xcode project and re-build.
Hope that helps.
In my case the actual error was described a lot further down.
It was a header file that couldn't be found because I hadn't set the Header Search Paths in my target Build Settings.

Resources