所以我现在已经运行这个rails服务器大约一个月了,在重新启动计算机之后(我试图在我的mac上添加全局环境变量)服务器现在在运行&#34时启动这个错误; rails s"。我确保localhost和虚拟域都指向127.0.0.1。正如我所说,在重新启动之前,这工作正常,但之后是错误弹出的时候。
=> Booting Unicorn
=> 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
Exiting
/Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn- 4.8.3/lib/unicorn/configurator.rb:604:in `pack_sockaddr_in': getaddrinfo: nodename nor servname provided, or not known (SocketError)
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-4.8.3/lib/unicorn/configurator.rb:604:in `canonicalize_tcp'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-4.8.3/lib/unicorn/configurator.rb:590:in `expand_addr'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:236:in `listen'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:809:in `block in bind_new_listeners!'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:809:in `each'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:809:in `bind_new_listeners!'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:138:in `start'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-rails-2.2.0/lib/unicorn_rails.rb:33:in `run'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-1.6.0/lib/rack/server.rb:286:in `start'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/server.rb:80:in `start'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/chris/bbplm/bin/rails:8:in `require'
from /Users/chris/bbplm/bin/rails:8:in `<top (required)>'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/lib/spring/client/rails.rb:27:in `load'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/lib/spring/client/rails.rb:27:in `call'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/lib/spring/client/command.rb:7:in `call'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/lib/spring/client.rb:26:in `run'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/bin/spring:48:in `<top (required)>'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/lib/spring/binstub.rb:11:in `load'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/spring-1.2.0/lib/spring/binstub.rb:11:in `<top (required)>'
from /Users/chris/bbplm/bin/spring:16:in `require'
from /Users/chris/bbplm/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
从gemfile中删除spring后,我捆绑安装并尝试重新运行服务器。这是我收到的错误。
=> Booting Unicorn
=> 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
Exiting
/Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-4.8.3/lib/unicorn/configurator.rb:604:in `pack_sockaddr_in': getaddrinfo: nodename nor servname provided, or not known (SocketError)
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-4.8.3/lib/unicorn/configurator.rb:604:in `canonicalize_tcp'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-4.8.3/lib/unicorn/configurator.rb:590:in `expand_addr'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:236:in `listen'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:809:in `block in bind_new_listeners!'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:809:in `each'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:809:in `bind_new_listeners!'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:138:in `start'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/unicorn-rails-2.2.0/lib/unicorn_rails.rb:33:in `run'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-1.6.0/lib/rack/server.rb:286:in `start'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/server.rb:80:in `start'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/chris/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:8:in `require'
from bin/rails:8:in `<main>'
答案 0 :(得分:2)
检查etc/hosts
是否有127.0.0.1 localhost
这是我的问题,虽然它在哪里以及如何发展我不知道!