Tahmid Rahman
Tahmid Rahman

Reputation: 758

Build Hangs While Running 'react-native run-ios'

I am stuck on a problem. While running commnand from cli react-native run-ios

Found Xcode project myproject.xcodeproj
Launching iPhone 6 (iOS 10.3)...
Building using "xcodebuild -project myproject.xcodeproj -configuration Debug -scheme myproject -destination id=CB73A374-3E21-4C73-BEC4-AD29A583FCE8 -derivedDataPath build"
User defaults from command line:

IDEDerivedDataPathOverride = /Users/.../myproject/ios/build

It just hangs and then nothing happens, no response.

I already checked an earlier question in stackoverflow and issue in github, but got no help. I may have asked a duplicate question but I am in badly need of a solution. Any help will be highly appreciated.

Upvotes: 10

Views: 14801

Answers (4)

Fahmid
Fahmid

Reputation: 180

For someone stuck on it in 2023, for me just trying to start a React Native project following their documentation did not work.

My Mac is M1, which caused a lot of different issues. Eventually, I solved it by:

  1. Making sure my ruby version was correct. I used a combination of arch -arm64 rvm install 2.7.6 (The version being latest Ruby version required on boilerplate React Native project). Then to use the version, rvm use 2.7.6. I then initiated my React Native project using arch -arm64 npx react-native init <ProjectName>. Rest of the commands such as npx react-native run-ios worked as usual.
  2. Moving the project away from iCloud Drive folder fixed it from being stuck on "Building the app..." (Still takes a while to build).

I spent my weekend trying to solve this. Hope this helps.

Upvotes: 2

XplosiVe06
XplosiVe06

Reputation: 646

Another solution:

  • close your IDE

  • run in a terminal:

sudo kill -9 `ps aux | grep node | grep -v grep | awk '{print $2}'`
  • Re-open your IDE
  • re-run: (npx) react-native run-ios

Upvotes: 1

Nicholas Francis
Nicholas Francis

Reputation: 3693

This resolved the problem for me, Under project.workspace, there is a file called "contents.xcworkspacedata".(This can be opened from your IDE) There was a duplication of the fileref tag, removed one and ran react-native run-ios, and it worked.

<FileRef
      location = "group:project.xcodeproj">
   </FileRef>

Upvotes: 2

Emit Dutcher
Emit Dutcher

Reputation: 59

I know this is way later than the question was asked, but since it was never answered, I wanted to throw this up here cause it just happened to me.

I got past that by doing rm -rf node_modules/ and then doing npm install.

Hope this helps someone else in the future as well! :-D

Upvotes: 5

Related Questions