Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packager fails on macOS 10.12 Sierra #9309

Closed
goldenice opened this issue Aug 9, 2016 · 38 comments
Closed

Packager fails on macOS 10.12 Sierra #9309

goldenice opened this issue Aug 9, 2016 · 38 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@goldenice
Copy link

goldenice commented Aug 9, 2016

I have upgraded to the macOS Sierra beta yesterday, and the React Native Packager seems to fail. I've tried to reinstall the dependencies, but no use.

The output of the packager is this:

[11:45:02 AM] <START> Building Dependency Graph
[11:45:02 AM] <START> Crawling File System
[Hot Module Replacement] Server listening on /hot

React packager ready.

2016-08-09 11:45 node[6397] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-08-09 11:45 node[6397] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-08-09 11:45 node[6397] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
 ERROR  watch null EMFILE
{"code":"EMFILE","errno":"EMFILE","syscall":"watch null","filename":null}
Error: watch null EMFILE
    at exports._errnoException (util.js:873:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1217:21)

The only reference to that specific error I have found is this old issue on the Node 0.10 repo's. I have tried the 'fix' in that topic, namely increasing the open file references limit. That didn't work.

The issue occurs on both Node 4.4.7 and 6.3.1, on macOS Sierra 10.12 on a MBP 2015 15". Does anyone know what is going on here?

@deadlocked247
Copy link

deadlocked247 commented Aug 10, 2016

Just got this as well, also on sierra

@mc13an
Copy link

mc13an commented Aug 10, 2016

me as well, also on sierra

@mc13an
Copy link

mc13an commented Aug 10, 2016

Credit to @passwd for figuring this out

We were able to get it to work by increasing the max file limit and moving to watchman v4.6.0

here are the steps we followed:

1. increase max file limt

# check open file limit
sysctl kern.maxfiles

# edit sysctl
sudo vim /etc/sysctl.conf

# add these two lines
kern.maxfiles=10485760
kern.maxfilesperproc=1048576

# reboot
sudo reboot

# check new file limit
sysctl kern.maxfiles

2. upgrade to watchman 4.6

# clone repo
git clone https://github.com/facebook/watchman.git

# change to master branch
git checkout -b v4.6.0 v4.6.0

# run compiler
./autogen.sh
./configure --enable-lenient --without-pcre --with-python
make
sudo make install

# check watchman version
watchman -v

# result should be 4.6.0

@deadlocked247
Copy link

@mc-lean you're the best!!!

@goldenice
Copy link
Author

@mc-lean Nice! :)

Are there any plans to update watchman in the RN-repo so RN works out-of-the-box again?

@mc13an
Copy link

mc13an commented Aug 12, 2016

@goldenice I would guess that it is. Sierra is due out in September so I would think they would plan to support it out of the box soon

@aahlad-allari
Copy link

@mc-lean Thanks 👍

@kjpolaszek
Copy link

Great, it works. 👍

@zhaomiing
Copy link

thanks, you made my day :)

@jalmaas
Copy link

jalmaas commented Sep 13, 2016

System doesn't report the updated value when i run sysctl kern.maxfiles (reports 300k) but upgraded to watchman 4.7.0 with brew install watchman and it seems to work

@monder
Copy link

monder commented Sep 13, 2016

@jalmaas value updates only after reboot. Worked for me on GM.

But indeed, just updating to watchman 4.6.0+ seems to be enough.

@jalmaas
Copy link

jalmaas commented Sep 13, 2016

it didn't update after reboot here

@ide
Copy link
Contributor

ide commented Sep 13, 2016

React Native works fine with relatively up-to-date software. These are the settings that are working for me:

$ node --version
v6.5.0
$ watchman --version
4.6.0
$ sysctl kern.maxfiles
kern.maxfiles: 16384
$ sysctl kern.maxfilesperproc
kern.maxfilesperproc: 10240

@ide ide closed this as completed Sep 13, 2016
@lauborges
Copy link

unfortunately it does not work for me

macOS 10.12 (16A319)

$ node --version
-> v6.5.0
$ watchman --version
-> 4.6.0
$ sysctl kern.maxfiles
-> 10485760
$ sysctl kern.maxfilesperproc
-> 1048576
React packager ready.

2016-09-13 17:10 node[8707] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-13 17:10 node[8707] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-13 17:10 node[8707] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-13 17:10 node[8707] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-13 17:10 node[8707] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-13 17:10 node[8707] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-13 17:10 node[8707] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-13 17:10 node[8707] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
 ERROR  Error watching file for changes: EMFILE
{"code":"EMFILE","errno":"EMFILE","syscall":"Error watching file for changes:","filename":null}
Error: Error watching file for changes: EMFILE
    at exports._errnoException (util.js:1026:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1406:11)

@hghinaglia
Copy link

Isn't working for me 👎

Versions:

$node --version
v6.6.0

$watchman --version
4.7.0

$sysctl kern.maxfiles
kern.maxfiles: 10485760

$sysctl kern.maxfilesperproc
kern.maxfilesperproc: 1048576

Log:

2016-09-19 15:25 node[989] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-19 15:25 node[989] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-19 15:25 node[989] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
 ERROR  Error watching file for changes: EMFILE
{"code":"EMFILE","errno":"EMFILE","syscall":"Error watching file for changes:","filename":null}
Error: Error watching file for changes: EMFILE
    at exports._errnoException (util.js:1036:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1406:11)

@mager
Copy link

mager commented Sep 20, 2016

This worked perfectly for me. Thanks!

@InYourDreamz
Copy link

Upgrading watchman solved the issue for us.

@sri-rang
Copy link

No luck :(

@sri-rang
Copy link

sri-rang commented Sep 22, 2016

Upgrading watchman worked, brew didn't cooperate but heh..

$ git clone https://github.com/facebook/watchman.git
$ cd watchman
$ git checkout v4.7.0  # the latest stable release
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

@oscardemoya
Copy link

I was checking watchman issues and found out this one: facebook/watchman#358

When running watchman watch-list I got some permissions error.

chmod 0700 /usr/local/var/run/watchman/<USER>-state worked for me.

@hghinaglia
Copy link

hghinaglia commented Sep 22, 2016

FINALLY!!!

I ran the watchman watch-list command, then the error suggested me to run chmod 0700 /usr/local/var/run/watchman/<USER>-state as @OscarT said, then it worked!!

@sanqianpiao
Copy link

sanqianpiao commented Oct 27, 2016

got the same result on Sierra

@artforlife
Copy link

I get the following error when trying to compile the Watchman:

./autogen.sh: line 9: aclocal: command not found
./autogen.sh: line 11: automake: command not found
configure.ac:3: error: possibly undefined macro: AM_INIT_AUTOMAKE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:29: error: possibly undefined macro: AM_PROG_CC_C_O
configure.ac:30: error: possibly undefined macro: AM_PROG_AS
configure.ac:71: error: possibly undefined macro: AM_CONDITIONAL
configure.ac:113: error: possibly undefined macro: AM_PATH_PYTHON

@artforlife
Copy link

I was able to resolve the compilation issue after installing automate: brew install automake

@artforlife
Copy link

artforlife commented Oct 28, 2016

The project works in Simulator after following the steps from @mc-lean.

@sammosampson
Copy link

i ran brew install automake but still can't compile watchman

@artforlife
Copy link

@sammosampson What errors are you getting?

@artforlife
Copy link

artforlife commented Oct 30, 2016

After updating to OSX Sierra and XCode 8.1, I cannot compile any of the React-Native projects. I get the error that the OP had. At this point, I have not been able to resolve it. You may consider re-opening the issue.

Here is what it looks like when I try to compile the Snowflake starter project:

React packager ready.

2016-10-30 11:30 node31071 FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-10-30 11:30 node31071 FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-10-30 11:30 node31071 FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
ERROR watch null EMFILE
{"code":"EMFILE","errno":"EMFILE","syscall":"watch null","filename":null}
Error: watch null EMFILE
at exports._errnoException (util.js:856:11)
at FSEvent.FSWatcher._handle.onchange (fs.js:1296:21)

See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions.
~
Process terminated. Press to close the window

Similar errors show up when compiling some tutorials I had laying around (they worked under Sierra and XCode 7.3.1)

@bondarewicz
Copy link

bondarewicz commented Oct 30, 2016

@artforlife I'm having exact same issue although not related specifically to react-native, I'm in the process of updating to xcode 8.1 as after update to macOS sierra I was unable to run tests which depend on fs, any help appreciated...

EDIT: please look at this, installing watchman fixed this issue for me

@artforlife
Copy link

@bondarewicz Thanks for the idea. I have just tried downgrading to Xcode 7.3.1 and the problem still persists. This leads me to think that it lies not with Xcode but elsewhere. Perhaps the Development Tools is the problem.

My watchman version is already 4.7.0 ...

@bondarewicz
Copy link

@artforlife have you tried reinstall ? We need to debug this issue as many had the same problem but there is no definite answer yet...

@artforlife
Copy link

@bondarewicz I have tried reinstalling the watchman, but that didn't affect anything.

@artforlife
Copy link

I have the following configurations:

OSX: Sierra
XCode: 8.1
NodeJS: 5.1.0
Watchman: 4.6.0
kern.maxfiles: 10485760

I used to following steps to fix the issue.

  1. Run watchman watch-list
  2. Received the following error:

2016-10-30T18:24:39,064: [3239527360] the permissions on /usr/local/var/run/watchman/userman-state allow others to write to it. Verify that you own the contents and then fix its permissions by running chmod 0700 /usr/local/var/run/watchman/userman-state

  1. Followed the instruction in the error prompt above and ran

chmod 0700 /usr/local/var/run/watchman/userman-state

This fixed it. To summarize, it seems to have been a permissions problem on a Watchman directory.

@hbd
Copy link

hbd commented Nov 18, 2016

Can confirm that this issue was related to tmux. After getting the error

2016-11-04 12:51 node[4311] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-11-04 12:51 node[4311] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: Error watching file for changes: EMFILE
    at exports._errnoException (util.js:1026:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1406:11)
npm ERR! Test failed.  See above for more details.

from running react-native commands, I installed watchman, but continued to get the issue. Running react-native commands outside of tmux now works. I do not have jest installed. None of the other fixes mentioned here had any effect.

@beshur
Copy link

beshur commented Nov 23, 2016

Solved for me with updating Xcode and installing watchman with brew (which is not possible with 7.x Xcode)

edit
Also sudo chown -R $(whoami) ~/

@cborchert
Copy link

cborchert commented Dec 1, 2016

I followed most of the steps above including upgrading watchman, and increasing the max file limit, but what solved it for me was verifying permissions by running watchman watch-list and then following the directions it provided. Thanks @OscarT and @hghinaglia!

@abuammar
Copy link

updating watchman solved me the issue when i updated macOS Sierra

ERROR Error watching file for changes: EMFILE
{"code":"EMFILE","errno":"EMFILE","syscall":"Error watching file for changes:","filename":null}
Error: Error watching file for changes: EMFILE
at exports._errnoException (util.js:1036:11)
at FSEvent.FSWatcher._handle.onchange (fs.js:1406:11)

@jlampa
Copy link

jlampa commented Jul 3, 2017

Note that this is also what happens if you don't have Watchman installed at all.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests