React Native Project Run Error [How to Solve]

React native version: 0.67

Initialize and run the project according to the official document

$ npx react-native init AwesomeProject
$ yarn ios

The error message is as follows

The following build commands failed: 
	PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/zh/Library/Developer/Xcode/DerivedData/AwesomeProject-cvxgkvyxvvajjvaydcivldmzlgxr/Build/Intermediates.noindex/ (in target 'FBReactNativeSpec' from project 'Pods') (1 failure)

Possible causes

  1. The project path contains white space characters
  2. NVM is used for node installation

I’m because of reason 2. The solution is to go to node_modules/react-native/scripts/find-node. SH, comment out this part of the file

if [[ -s "$HOME/.nvm/" ]]; then
   # shellcheck source=/dev/null
   . "$HOME/.nvm/"
 elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/" ]]; then
   # shellcheck source=/dev/null
   . "$(brew --prefix nvm)/"

Then execute yarn IOS , and the execution will be successful

Similar Posts: