React-native: AwesomeProject close quickly after run in the iOS Simulator

Created on 13 Sep 2016  路  36Comments  路  Source: facebook/react-native

Hi:
I just test the AwesomeProject by the https://facebook.github.io/react-native/releases/next/docs/getting-started.html
run the following command

react-native init AwesomeProject
cd AwesomeProject
react-native run-ios

I see the AwesomeProject in Simulator ,but AwesomeProject exit quickly ! I click the icon of AwesomeProject,It exit quickly too. I run the project in Xcode , everything is normal .
Why?

iOS Locked

Most helpful comment

Me 2,

Loading dependency graph, done.
Bundling index.ios.js [development, non-minified, hmr disabled] 100.0% (301/301), done.

But Awesomeproject always close immediately at welcome screen, tried on xcode still the same.

Bellow solution works for me (not need to rollback anything):

Go to your project, edit package.json.
Find:

"scripts": {

Add bellow:

"postinstall": "sed -i '' 's/\\[headers\\[@\"Content-Length\"\\] unsignedIntValue\\]/\\[headers\\[@\"Content-Length\"\\] intValue\\]/' ./node_modules/react-native/React/Base/RCTMultipartStreamReader.m"

Like this:

"scripts": {
      "start": "node node_modules/react-native/local-cli/cli.js start",
      "test": "jest",
      "postinstall": "sed -i '' 's/\\[headers\\[@\"Content-Length\"\\] unsignedIntValue\\]/\\[headers\\[@\"Content-Length\"\\] intValue\\]/' ./node_modules/react-native/React/Base/RCTMultipartStreamReader.m"
},

Then
Open terminal, CD to your project, run : npm link

Hope its works for you :)

All 36 comments

I'm having the same problem. I just installed everything and generated the project.

When I ran react-native run-ios from the CLI, it returned ** BUILD SUCCEEDED **. The simulator ran just fine but when I click to open the project, it crashed.

When I ran the simulator from Xcode, it got stuck on the white page where it says "Powered by React Native" and I couldn't see the welcome message. Xcode also throws an error in main.

first run npm start, then ok

@jekey as you said, running npm start first and then react-native run-ios solved it.

If this is intentional then perhaps it should be added to the documentation.

@jekey @nelsonr Thanks! It works after npm start.

Same issue, but run npm start then react-native run-ios is not working for me.
I tried to open project in xcode, hang with this "libc++abi.dylib: terminating with uncaught exception of type NSException"

@huiyinchu, hello... Same error here:

xCode output: libc++abi.dylib: terminating with uncaught exception of type NSException

Have you solved this problem? How? Thanks!

same here on macOS + run-ios
open hello-world example in emulator and it close right the way.

Thanks! I had the same problem!

Hi everyone
I know why now.

one possible solution ( at least it work for me)

"Shadowsocks" cause this problem.
This is a proxy software, I think most china developer is using this.
my problem is fixed right after Shadowsocks is closed.

if you are using some kind of proxy software, try close it see if it fixed the problem

@1c7 thx

I had the same issue in mac. I just unchecked Web Proxy(HTTP) and Secure Web Proxy (HTTPS) under Systems Preferences > Network > Advance > Proxies
That's it and React Native start working

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

Hi there,
Yesterday, I still run-ios OK. But today, I have this problem. I think I need to cleanup node, npm, yarn and install again.

I too am still having a problem with this. I uninstalled NPM, Node, Brew, react-native..and than reinstalled everything. And still getting the same error.

My other swift apps works fine, but it's only the react-native app that closes right away. I also am making sure npm start is running too.

Yes same as @masudhossain

I am having the same problem as @masudhossain too

Another vote for this issue... I'll try and resolve myself and share the solution.

same here, automatic closing after packager loading dependecy graphics done

same here, I thought it might be due to the new version of 0.48, but it still happened when I roll back to 0.47.

I rolled back to 0.45.1 boom, running perfectly

Had the same issue on 0.48.0 and got it working again on 0.47.2.

Me 2,

Loading dependency graph, done.
Bundling index.ios.js [development, non-minified, hmr disabled] 100.0% (301/301), done.

But Awesomeproject always close immediately at welcome screen, tried on xcode still the same.

Bellow solution works for me (not need to rollback anything):

Go to your project, edit package.json.
Find:

"scripts": {

Add bellow:

"postinstall": "sed -i '' 's/\\[headers\\[@\"Content-Length\"\\] unsignedIntValue\\]/\\[headers\\[@\"Content-Length\"\\] intValue\\]/' ./node_modules/react-native/React/Base/RCTMultipartStreamReader.m"

Like this:

"scripts": {
      "start": "node node_modules/react-native/local-cli/cli.js start",
      "test": "jest",
      "postinstall": "sed -i '' 's/\\[headers\\[@\"Content-Length\"\\] unsignedIntValue\\]/\\[headers\\[@\"Content-Length\"\\] intValue\\]/' ./node_modules/react-native/React/Base/RCTMultipartStreamReader.m"
},

Then
Open terminal, CD to your project, run : npm link

Hope its works for you :)

worked.. thanks @quangduz. awesome..

hmm why now after using @quangduz soution then run npm link, my react-native said "child process err"?

Hi @marendra,
This solution use for 0.48.0, not for 0.45.1
I think you need to update your react native to 0.48.0.

it worked, for my solution i just run : chmod -R 777 node_modules , many thanks @quangduz

Hi @quangduz, the problem is solved with your solution!
Thank you ;-)

Hi, I have the same issue.
react-native-cli: 2.0.1
react-native: 0.48.0
I tried to use @quangduz solution, but had this WARN after run: npm link :
npm WARN lifecycle [email protected]~postinstall: cannot run in wd %s %s (wd=%s) [email protected] sed -i '' 's/[headers[@"Content-Length"] unsignedIntValue]/[headers[@"C
ontent-Length"] intValue]/' ./node_modules/react-native/React/Base/RCTMultipartStreamReader.m /Users/.../Documents/stud/r_n_todo
up to date in 3.37s.
Can anyone help with it? Thanks.

@D-plus : Whats your OS ? I guess Ubuntu or Windows ?

I got it working with

react-native init AppName --version 0.47.2

@quangduz: My OS is: macOS Sierra 10.12.6 (16G29)

@D-plus

I think this error about npm permission when work with wd (working directory).
Founded some solutions for you in this case:

1. Run sudo npm run postinstall manually. OR
2. Run npm install --unsafe-perm OR
3. Run sudo chown -R my_name /usr/local

Good luck !

@quangduz
Thanks man! The first option works!

  1. Run sudo npm run postinstall

Congrats,
RN 0.48.1 fixed this problem. But it dont work with FBSDK 0.6.1 .... Use 0.6.0

This issue occurs because iOS build folder not updating.
just delete 'build' folder from 'ios' and run react-native run-ios again and it should work.

@faisal3413 thanks a lot, u really saved my day...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phongyewtong picture phongyewtong  路  3Comments

anchetaWern picture anchetaWern  路  3Comments

DreySkee picture DreySkee  路  3Comments

lazywei picture lazywei  路  3Comments

TrakBit picture TrakBit  路  3Comments