我创建了这样的新rails应用程序。
rails new my_app -d postgres
cd my_app
bundle install
rails s
服务器成功启动如下:
=> Booting Puma
=> Rails 5.0.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.6.0 (ruby 2.3.0-p0), codename: Sleepy Sunday Serenity
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
当我在浏览器上访问http://localhost:3000时,出现以下错误:
IPAddr::InvalidAddressError: invalid address
from /Users/ror/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/ipaddr.rb:560:in `in6_addr'
from /Users/ror/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/ipaddr.rb:497:in `initialize'
from /Users/ror/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/ipaddr.rb:515:in `new'
from /Users/ror/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/ipaddr.rb:515:in `coerce_other'
from /Users/ror/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/ipaddr.rb:171:in `include?'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/web-console-3.3.1/lib/web_console/whitelist.rb:17:in `block in include?'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/web-console-3.3.1/lib/web_console/whitelist.rb:17:in `any?'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/web-console-3.3.1/lib/web_console/whitelist.rb:17:in `include?'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/web-console-3.3.1/lib/web_console/request.rb:16:in `from_whitelisted_ip?'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/web-console-3.3.1/lib/web_console/whiny_request.rb:8:in `from_whitelisted_ip?'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/web-console-3.3.1/lib/web_console/middleware.rb:20:in `block in call'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/web-console-3.3.1/lib/web_console/middleware.rb:18:in `catch'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/web-console-3.3.1/lib/web_console/middleware.rb:18:in `call'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:36:in `call_app'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:24:in `block in call'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:70:in `block in tagged'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:26:in `tagged'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/tagged_logging.rb:70:in `tagged'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:24:in `call'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/quiet_assets.rb:13:in `call'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/request_id.rb:24:in `call'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/method_override.rb:22:in `call'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/runtime.rb:22:in `call'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/executor.rb:12:in `call'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/static.rb:136:in `call'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/sendfile.rb:111:in `call'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:522:in `call'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/puma-3.6.0/lib/puma/configuration.rb:225:in `call'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/puma-3.6.0/lib/puma/server.rb:578:in `handle_request'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/puma-3.6.0/lib/puma/server.rb:415:in `process_client'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/puma-3.6.0/lib/puma/server.rb:275:in `block in run'
from /Users/ror/.rvm/gems/ruby-2.3.0/gems/puma-3.6.0/lib/puma/thread_pool.rb:116:in `block in spawn_thread'
我正在使用rvm和ruby 2.3.1,rails 5.0。 请帮我解决这个问题。 感谢。