Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: str.replace is not a function #1883

Closed
JosueOlivero opened this issue Mar 21, 2023 · 16 comments
Closed

Error: str.replace is not a function #1883

JosueOlivero opened this issue Mar 21, 2023 · 16 comments

Comments

@JosueOlivero
Copy link

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?

image

Thanks!

@berikiushi
Copy link

@JosueOlivero

try this, it helped me - https://stackoverflow.com/a/68579858/2005679

@JosueOlivero
Copy link
Author

@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.

@emilstepanian
Copy link

Same issue here

@pen1064
Copy link

pen1064 commented Mar 25, 2023

same here, but I am using Windows
image

@DEVARSHI-GOHEL
Copy link

DEVARSHI-GOHEL commented Mar 27, 2023

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

@TMisiukiewicz
Copy link
Collaborator

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

@JosueOlivero
Copy link
Author

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!

@mohammad-fahad
Copy link

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!!

@jaykksingh
Copy link

sudo xcode-select --switch /Applications/Xcode.app
run this and you will be good to go

@Stormheg
Copy link

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.

@Spencer1O1
Copy link

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.

@sgursoy
Copy link

sgursoy commented Jul 17, 2023

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.

@AlexCods
Copy link

In my case, i just had to open XCode to accept new licence agreements

image

@abanoubamin
Copy link

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

@Nagibaba
Copy link

Make sure you have run pod install first

@zacchaeuschok
Copy link

I ran this:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

16 participants