question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues setting up new project on Mac OS X (10.11.6)

See original GitHub issue

Hi, I tried setting up a new react-native project following this guide https://facebook.github.io/react-native/docs/getting-started.html#content and ran into two independent issues that I resolved using a few hacks but wanted to post about to see if fixes could be made for future react-native versions.


For reference, these are the versions of node, npm, react-native, react, and react-native-cli that this affects: node: v6.2.0 npm: 3.10.6 “react”: “15.2.1” “react-native”: “0.31.0” “react-native-cli”: “^1.0.0”

This is the version of Mac OS X I’m using: OS X El Capitan Version 10.11.6


I mostly followed the guide and did the following:

brew install node
brew install watchman
cd ~/<my-repo-with-a-package-json-and-node-modules-already>
mkdir mobile && cd mobile && echo "{}" > package.json
npm install react-native-cli --save-dev
./node_modules/.bin/react-native init app
cd app
react-native run-ios

When I ran react-native run-ios, the first issue I encountered was a ulimit issue in setup_env.sh:

<my-repo>/mobile/app/node_modules/react-native/local-cli/setup_env.sh: line 9: ulimit: open files: cannot modify limit: Operation not permitted
child_process.js:498
    throw err;
    ^

This seems to be an issue with the “ulimit -n 2048” line in setup_env.sh with my Mac OS X version (10.11.6). I manually changed setup_env.sh (inside the node_modules folder) to use 1024 as the limit and react-native run-ios was able to run properly. I was wondering if this limit needs to be updated for newer versions of OS X.

This also seems to be the issue described here: https://github.com/facebook/react-native/issues/5668


Once I hacked the ulimit issue, there was another issue that occurred at runtime after the ios js bundle was created:

ReferenceError: Can't find variable: require

I was able to resolve this issue - but I had to do so by changing the directory where I ran “react-native init”. According to this issue https://github.com/facebook/react-native/issues/3379 because I initially ran react-native init inside a directory that already had a package.json (and corresponding node_modules), I was seeing this require error (I also saw that the react native bundler was loading more files originally). The fix I used to get around this is to initialize my app in a separate directory - but I would like to keep a single repository structure, so I was wondering if there’s a way to prevent the react-native bundler from using any node_modules from parent directories (I don’t know if the --root command does this or not).

Thanks for any help.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lavystordcommented, Sep 2, 2016

maybe something about file permission,try chmod 777 -Ryour project

0reactions
facebook-github-botcommented, Nov 14, 2016

@charpeni tells me to close this issue. If you think it should still be opened let us know why.

Read more comments on GitHub >

github_iconTop Results From Across the Web

16 Common OS X El Capitan Problems & How to Fix Them
We show you how to fix the most common OS X El Capitan problems on your Mac.
Read more >
Common Mac OS X 10.11 El Capitan Problems & Solutions
This article shows you the most common OS X El Capitan problems and provides you detailed solutions to fix these issues.
Read more >
Upgrade OS X El Capitan to Big Sur? - Apple Community
I am running OS X El Capitan version 10.11.6, on my 11-inch early 2015 MacBookAir, and have avoided upgrading the OS because of...
Read more >
Fixing Wi-Fi Issues in OS X El Capitan - OSXDaily
You're going to be deleting a few system level preference files and creating a new network location. Before getting started, you should start ......
Read more >
14 solutions to common OS X El Capitan problems on Mac
One of the easiest solutions for this problem is to fully reboot your computer and clear any current issues that Yosemite is experiencing....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found