Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
775 views
in Technique[技术] by (71.8m points)

ruby - rails server cannot start; getaddrinfo: nodename nor servname provided, or not known (SocketError)

I have not found a solution to the problem, however someone did already ask about the same problem a few days ago - (Rails Server Keeps Exiting (SocketError))

After I start a rails server the system returns some error I cannot understand. To install Ruby on Rails on my mac I did everything as listed on http://railsapps.github.io/installrubyonrails-mac.html

here is my terminal response:

$ 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 `<top (required)>'
    from /Users/alexshel/workspace/myapp/bin/rails:8:in `require'
    from /Users/alexshel/workspace/myapp/bin/rails:8:in `<top (required)>'
    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 `<top (required)>'
    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 `<top (required)>'
    from /Users/alexshel/workspace/myapp/bin/spring:13:in `require'
    from /Users/alexshel/workspace/myapp/bin/spring:13:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

Please help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The problem solved by adding 127.0.0.1 localhost record to the private/etc/hosts file, which was removed by some reason before.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...