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

MacOS Sierra Error with EMFILE upon NPM start #10028

Closed
mrkhan2 opened this issue Sep 21, 2016 · 30 comments
Closed

MacOS Sierra Error with EMFILE upon NPM start #10028

mrkhan2 opened this issue Sep 21, 2016 · 30 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@mrkhan2
Copy link

mrkhan2 commented Sep 21, 2016

just upgraded to Sierra and am running into a problem when i enter NPM start

For background, I am on react-native 0.26 and unfortunately cannot upgrade at the moment. I also do not have brew

My logs show the following when I try NPM start:

2016-09-21 12:35 node[1515] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-21 12:35 node[1515] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-21 12:35 node[1515] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-21 12:35 node[1515] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-21 12:35 node[1515] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-21 12:35 node[1515] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-21 12:35 node[1515] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-21 12:35 node[1515] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-21 12:35 node[1515] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-21 12:35 node[1515] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-21 12:35 node[1515] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-21 12:35 node[1515] (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:953:11)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1400:11)
@AlexisLeon
Copy link

AlexisLeon commented Sep 21, 2016

I have the same error.
I just upgraded to macOS Sierra too

➜  example npm start  

> example@0.0.1 start /Users/alex/Developer/example
> node node_modules/react-native/local-cli/cli.js start

Scanning 581 folders for symlinks in /Users/alex/Developer/example/node_modules (6ms)
 ┌────────────────────────────────────────────────────────────────────────────┐ 
 │  Running packager on port 8081.                                            │ 
 │                                                                            │ 
 │  Keep this packager running while developing on any JS projects. Feel      │ 
 │  free to close this tab and run your own packager instance if you          │ 
 │  prefer.                                                                   │ 
 │                                                                            │ 
 │  https://github.com/facebook/react-native                                  │ 
 │                                                                            │ 
 └────────────────────────────────────────────────────────────────────────────┘ 
Looking for JS files in
   /Users/alex/Developer/example 

[1:56:23 PM] <START> Building Dependency Graph
[1:56:23 PM] <START> Crawling File System
[Hot Module Replacement] Server listening on /hot

React packager ready.

2016-09-21 13:56 node[15435] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-21 13:56 node[15435] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-21 13:56 node[15435] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)
2016-09-21 13:56 node[15435] (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)

See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions.

npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.4.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! example@0.0.1 start: `node node_modules/react-native/local-cli/cli.js start`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the example@0.0.1 start script 'node node_modules/react-native/local-cli/cli.js start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the example package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node node_modules/react-native/local-cli/cli.js start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs example
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls example
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/alex/Developer/example/npm-debug.log

@Etheryte
Copy link
Contributor

Have you checked the solutions in #9309?

@mrkhan2
Copy link
Author

mrkhan2 commented Sep 21, 2016

@Etheryte yes checked it out. Seems to only be a solution for those with brew/watchman installed.

@leecade
Copy link

leecade commented Sep 22, 2016

resolved via: leecade/react-native-practice#21

@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.

@AlexisLeon
Copy link

AlexisLeon commented Sep 24, 2016

The problem can be solved by reinstalling react-native-cli:

npm uninstall -g react-native-cli
npm install -g react-native-cli

@raichur
Copy link

raichur commented Sep 24, 2016

@AlexisLeon that didn't work for me.

@Luavis
Copy link

Luavis commented Sep 27, 2016

This answer(#9309) work to me. I create and eidt new sysctl.conf and install watchman through homebrew.

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

@gnestor
Copy link
Contributor

gnestor commented Sep 27, 2016

I'd like to add that I've been running the packager without watchman for 3-4 months because React Native's Node packager doesn't depend on watchman. However, after upgrading to macOS Sierra the Node packager started failing with the above errors. Installing the current version of watchman (brew install watchman) did solve the issue for me, but something obviously regressed and it would be good to understand what that is.

@bbb324
Copy link

bbb324 commented Sep 30, 2016

@Luavis still didn't work, when I execute ./autogen.sh

./autogen.sh: line 9: aclocal: command not found
./autogen.sh: line 10: autoheader: command not found
./autogen.sh: line 11: automake: command not found
./autogen.sh: line 12: autoconf: command not found

@Luavis
Copy link

Luavis commented Oct 2, 2016

@bbb324 Could you try install watchman by homebrew

@mrkhan2 mrkhan2 closed this as completed Oct 6, 2016
@sanqianpiao
Copy link

Thanks to @Luavis , I followed his steps, still resulted in failure.
In my case, need another operation that mentioned below:
#910 (comment)

@mikeyang01
Copy link

I reinstall node, watchman, npm and etc, finally everything goes fine!
I think new updates about supporting mac OS Sierra were included in the package.
brew install node
brew install watchman
brew link automake pcre
npm install -g react-native-cli
export ANDROID_HOME=~/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}
react-native run-android

@ankitduseja
Copy link

brew install watchman solved it for me but had to update xcode to 8.1 also in order to install watchman.

@evilDave
Copy link

@gnestor needed to install watchman - thanks!

@Nick011
Copy link

Nick011 commented Nov 24, 2016

@Luavis holy cow after 2-3 hours of searching, setting kern.maxfiles! Never would have got it. Thank you!

jokester added a commit to jokester/reactnative-typescript-boilerplate that referenced this issue Nov 29, 2016
@evilDave
Copy link

Just FYI, I did not change the kern maxfiles, I only installed watchman.

$ sysctl kern.maxfiles
kern.maxfiles: 12288
$ sysctl kern.maxfilesperproc
kern.maxfilesperproc: 10240

perhaps there are two separate issues here - the project that I am building is pretty small and simple at the moment.

@mg
Copy link

mg commented Dec 17, 2016

If you are still getting this error and are using tmux on MacOS Sierra, try open a new terminal without tmux and run 'watchman version'. After doing that, it was fixed for me within tmux.

@levarberry
Copy link

Installing watchman worked for me.

@manuelprojects
Copy link

Same, installed watchman fixed the issue

@manbearshark
Copy link

manbearshark commented Jun 29, 2017

This just happened to me after transferring my environment from an old MacBook Pro to a brand new one.

Using Watchman 4.7.0 and brew - problem seems to be a permissions issue with the watchman state directory, so running:

chmod 0700 /usr/local/var/run/watchman/<YOUR USERNAME HERE>-state

did the job.

@sandip7484
Copy link

@Luavis i install watchman by homebrew thanks!!

@AnshuGoyal
Copy link

Clearing the builds in android->app->build folder and hitting react-native run-android worked for me.

@johnwangel
Copy link

Hello. I have tried everything listed above, but I continue to get this error: node[10626] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-22)

I just upgraded to High Sierra. I had deleted XCode and Android Studio, and then reinstalled both.
I've installed watchman 4.9.0 (and also uninstalled) - no help.
I've increased the max file limit - no help.
I've reinstalled react-native and npm - no help.

Any other ideas what I can do.

Thank you,
John

@viatsko
Copy link

viatsko commented Oct 10, 2017

This is a correct way of increasing limit on max files for Mac OS X Sierra and above https://superuser.com/a/1171028, works for me on a huge repo w/o any issues (and doesn't in case of default limits)

@viatsko
Copy link

viatsko commented Oct 10, 2017

Actually, what if react-native/nuclide will provide instructions on how to raise limit instead of throwing an error?

@prancky
Copy link

prancky commented Oct 14, 2017

@johnwangel this will help you to fix that error https://facebook.github.io/watchman/docs/install.html

@johnwangel
Copy link

Thank you @pranky. I tried reinstalling watchman and just about everything else I could think of, to no avail. The thing that worked was to create a new project and port the code into that project - so I guess there was something cached in the old project that I wasn't able to find.

@Premjeet-Singh
Copy link

brew install watchman worked for me.

@gramster
Copy link

gramster commented Feb 17, 2018

Increasing file limits, installing watchman and reinstalling react-native-cli did not fix this for me. Why is this issue closed?

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
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