When building for physical iPhone throws Command PhaseScriptExecution failed with a nonzero exit code

I developed my app with React-Native-CLI, version 0.67.2.

I use Xcode 16 on MacOS Sequoia 15.0.1

It builds and runs fine on any simulator, iOS 17 or iOS 18. As soon as I build it for my iPhone 12 iOS 17.6.1 or archive, it throws this error "Command PhaseScriptExecution failed with a nonzero exit code" at the last time. It actually starts the Metro.

I made my iPhone into developer mode. Paired it with MacOS.

The thing I don't get why it doesn't work on my iPhone when it works fine on simulators. It doesn't even archive.

Anyone encountered something like this in the past?

When building for physical iPhone throws Command PhaseScriptExecution failed with a nonzero exit code
 
 
Q