el servidor de Rails no puede iniciarse; getaddrinfo: nombre de nodo ni nombre de servidor proporcionado o no conocido (SocketError)

No he encontrado una solución al problema, sin embargo, alguien ya preguntó por el mismo problema hace unos días: ( Rails Server Keeps Exiting (SocketError) )

Después de iniciar un servidor de Rails, el sistema devuelve un error que no puedo entender. Para instalar Ruby on Rails en mi mac, hice todo lo que se indica en http://railsapps.github.io/installrubyonrails-mac.html

Aquí está mi respuesta terminal:

$ rails server => Booting WEBrick => Rails 4.2.0 application starting in development on http://localhost:3000 => Run `rails server -h` for more startup options => Ctrl-C to shutdown server [2015-02-28 02:14:46] INFO WEBrick 1.3.1 [2015-02-28 02:14:46] INFO ruby 2.2.0 (2014-12-25) [x86_64-darwin14] Exiting /Users/alexshel/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/socket.rb:232:in `getaddrinfo': getaddrinfo: nodename nor servname provided, or not known (SocketError) from /Users/alexshel/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/socket.rb:232:in `foreach' from /Users/alexshel/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/socket.rb:459:in `tcp_server_sockets' from /Users/alexshel/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/utils.rb:70:in `create_listeners' from /Users/alexshel/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/server.rb:133:in `listen' from /Users/alexshel/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/server.rb:114:in `initialize' from /Users/alexshel/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/webrick/httpserver.rb:45:in `initialize' from /Users/alexshel/.rvm/gems/ruby-2.2.0@global/gems/rack-1.6.0/lib/rack/handler/webrick.rb:32:in `new' from /Users/alexshel/.rvm/gems/ruby-2.2.0@global/gems/rack-1.6.0/lib/rack/handler/webrick.rb:32:in `run' from /Users/alexshel/.rvm/gems/ruby-2.2.0@global/gems/rack-1.6.0/lib/rack/server.rb:286:in `start' from /Users/alexshel/.rvm/gems/ruby-2.2.0@global/gems/railties-4.2.0/lib/rails/commands/server.rb:80:in `start' from /Users/alexshel/.rvm/gems/ruby-2.2.0@global/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:80:in `block in server' from /Users/alexshel/.rvm/gems/ruby-2.2.0@global/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap' from /Users/alexshel/.rvm/gems/ruby-2.2.0@global/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server' from /Users/alexshel/.rvm/gems/ruby-2.2.0@global/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!' from /Users/alexshel/.rvm/gems/ruby-2.2.0@global/gems/railties-4.2.0/lib/rails/commands.rb:17:in `' from /Users/alexshel/workspace/myapp/bin/rails:8:in `require' from /Users/alexshel/workspace/myapp/bin/rails:8:in `' from /Users/alexshel/.rvm/gems/ruby-2.2.0@myapp/gems/spring-1.3.3/lib/spring/client/rails.rb:27:in `load' from /Users/alexshel/.rvm/gems/ruby-2.2.0@myapp/gems/spring-1.3.3/lib/spring/client/rails.rb:27:in `call' from /Users/alexshel/.rvm/gems/ruby-2.2.0@myapp/gems/spring-1.3.3/lib/spring/client/command.rb:7:in `call' from /Users/alexshel/.rvm/gems/ruby-2.2.0@myapp/gems/spring-1.3.3/lib/spring/client.rb:26:in `run' from /Users/alexshel/.rvm/gems/ruby-2.2.0@myapp/gems/spring-1.3.3/bin/spring:48:in `' from /Users/alexshel/.rvm/gems/ruby-2.2.0@myapp/gems/spring-1.3.3/lib/spring/binstub.rb:11:in `load' from /Users/alexshel/.rvm/gems/ruby-2.2.0@myapp/gems/spring-1.3.3/lib/spring/binstub.rb:11:in `' from /Users/alexshel/workspace/myapp/bin/spring:13:in `require' from /Users/alexshel/workspace/myapp/bin/spring:13:in `' from bin/rails:3:in `load' from bin/rails:3:in `' 

Por favor ayuda.

El problema se resolvió agregando 127.0.0.1 localhost registro 127.0.0.1 localhost al archivo private/etc/hosts , que se eliminó por algún motivo anteriormente.

Intente cambiar a la encoding UNIX:

 brew install dos2unix sudo dos2unix -c mac /private/etc/hosts 

Tuve un problema similar con Redis en un entorno de Rails. Agregué el número de puerto y “Redis” a mi archivo / private / etc / hosts en mi mac, y resolví el error. Digamos que su número de puerto es “1234”, agregaría: 1234 redis. En el caso de localhost, debe agregar: 127.0.0.1 localhost. Espero que esto proporcione al menos algunas pistas sobre su problema particular.

Para cualquier futuro usuario que se encuentre con este problema, pude resolverlo agregando lo siguiente al final de mi private/etc/hosts .

127.0.0.1 YOURNAME-MacBook-Pro.local

Actualice YOURNAME-MacBook-Pro a cualquiera que sea el nombre de su máquina y esperamos que esté todo listo.