Error: str.replace is not a function
Environment
System: OS: macOS 13.2.1 CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz Memory: 116.00 MB / 8.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 14.17.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 6.14.13 - /usr/local/bin/npm Watchman: 2023.03.13.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.12.0 - /Users/jolivero/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2022.1 AI-221.6008.13.2211.9619390 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 18.0.1.1 - /usr/bin/javac npmPackages: @react-native-community/cli: ^10.2.1 => 10.2.1 react: ^18.2.0 => 18.2.0 react-native: ^0.71.4 => 0.71.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Description
Hello there, I'm trying a new app, and I got this error. Any idea?
Thanks!
@JosueOlivero
try this, it helped me - https://stackoverflow.com/a/68579858/2005679
@JosueOlivero
try this, it helped me - https://stackoverflow.com/a/68579858/2005679
I already have Command Line Tools selected. Just in case I re-select it again, but it didn't work.
Same issue here
same here, but I am using Windows

hi, did you find solution to this problem? i have tried doing the command line tools thing but it's not working for me and this error is occurring after creating new project. Are you using js or ts as before i had created a project in TS and it was working fine. The issue is with iOS device only as it works fine in android devices
looks like it throws an error because it cannot run xcodebuild command on your machines. Can you make sure you have XCode installed and running e.g. xcodebuild -list -json command in ios folder returns an output correctly?
In my opinion failing to read the project configuration should not prevent user from running an app. I'll prepare a fix that will only warn user about it and skip the check if configuration cannot be read
Hi, running the app with sudo allows it to properly read the xcodeproj file. It seems that it was a permission issue. Running the app with sudo solved it. Thanks!
Try this, it helped me - https://stackoverflow.com/a/68579858/2005679
Thanks @JosueOlivero your reference saved me as well, I was mad for a couple of days then I found this solution that fixed the issue like magic 😳
Stay blessed!!
sudo xcode-select --switch /Applications/Xcode.app run this and you will be good to go
Switching Xcode using xcode-select did not work for me.
Instead, this started happening for me after the xcode command line tools were updated through a software update. When I launched Xcode, it prompted me to accept an updated license agreement for the command line tools. After accepting the agreement the error went away. Hope this is useful to others running into this error.
If anyone else is still having problems, for some reason I had two projects in my ios folder and I had to remove the wrong one. The output of xcodebuild -list -json in the ios folder was helpful.
In my case issue is caused by accidentally writing a few characters in the project.pbxproj file within my ios folder of the project. This results in the str.replace is not a function error.
To resolve this problem, you can follow these steps:
Open the project.pbxproj file located in the ios folder. Locate the lines or characters that you mistakenly added or modified. Correct the characters you added or revert the unnecessary changes. Save the file and close it. This fix should resolve the str.replace is not a function error. When you restart and run your project, you should no longer encounter the issue.
In my case, i just had to open XCode to accept new licence agreements
Try this, it helped me - https://stackoverflow.com/a/68579858/2005679
Thanks @JosueOlivero your reference saved me as well, I was mad for a couple of days then I found this solution that fixed the issue like magic 😳
Stay blessed!!
This fixed mine
Make sure you have run pod install first
I ran this:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer