Issues setting up new project on Mac OS X (10.11.6)
See original GitHub issueHi, 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:
- Created 7 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
maybe something about file permission,try
chmod 777 -R
your project@charpeni tells me to close this issue. If you think it should still be opened let us know why.