Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

ERROR listen EAFNOSUPPORT :::8081 {"code":"EAFNOSUPPORT","errno":"EAFNOSUPPORT","syscall":"listen","address":"::","port":8081} #25899

Closed
fsp1990 opened this issue Aug 26, 2015 · 5 comments

Comments

@fsp1990
Copy link

fsp1990 commented Aug 26, 2015

I run react-native on centos64 , it will be error when npm start:

ERROR listen EAFNOSUPPORT :::8081
{"code":"EAFNOSUPPORT","errno":"EAFNOSUPPORT","syscall":"listen","address":"::","port":8081}
Error: listen EAFNOSUPPORT :::8081
at Object.exports._errnoException (util.js:837:11)
at exports._exceptionWithHostPort (util.js:860:20)
at Server._listen2 (net.js:1218:19)
at listen (net.js:1267:10)
at net.js:1370:9
at doNTCallback3 (node.js:440:9)
at process._tickCallback (node.js:346:17)
at Function.Module.runMain (module.js:473:11)
at startup (node.js:117:18)
at node.js:951:3

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

@owen-rpx
Copy link

I had got the same issue at our server. how to find out it?

@bnoordhuis
Copy link
Member

The error suggests that IPv6 is not supported by the operating system. Closing, not a node bug.

@nfranzmeier
Copy link

You can edit the following files to fix this issue:
Either node_modules/react-native/private-cli/src/server/runServer.js for the latest versions
//return http.createServer(app).listen(args.port, '::', readyCallback); // IPV6 any IP
//return http.createServer(app).listen(args.port, '127.0.0.1', readyCallback);
return http.createServer(app).listen(args.port, '0', readyCallback); // IPV4 any IP

or

On earlier versions it was in:

node_modules/react-native/packager/packager.js

//return http.createServer(app).listen(options.port, '::', readyCallback);
return http.createServer(app).listen(options.port, '0', readyCallback);

This is running on Centos 5.9

@enricxv
Copy link

enricxv commented Jan 12, 2016

It works for me

@xiezhigang
Copy link

Thinks @nfranzmeier

it works for me, too.

but need a little change!

from

return http.createServer(app).listen(options.port, '::', readyCallback);

to

//return http.createServer(app).listen(options.port, '::', readyCallback);
return http.createServer(app).listen(options.port, '127.0.0.1', readyCallback);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants