Rails better_errors gem服务器无法启动

时间:2015-10-16 08:44:48

标签: ruby-on-rails server better-errors-gem

因为我的是good_errors gem我无法使用命令轨道服务器启动我的服务器。我尝试在我的development.rb中添加行,例如BetterErrors::Middleware.allow_ip! "0.0.0.0/0"BetterErrors::Middleware.allow_ip! ENV['TRUSTED_IP'] if ENV['TRUSTED_IP'],但它不起作用。 当我尝试启动服务器时,这是我的错误消息:

/home/jakub/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/better_errors-2.1.1/lib/better_errors/exception_extension.rb:6:in `caller_locations': stack level too deep (SystemStackError)
from /home/jakub/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/better_errors-2.1.1/lib/better_errors/exception_extension.rb:6:in `set_backtrace'
from /home/jakub/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/web-console-2.0.0.beta3/lib/web_console/exception_extension.rb:15:in `call'
from /home/jakub/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/web-console-2.0.0.beta3/lib/web_console/exception_extension.rb:15:in `block in <class:Exception>'
from /home/jakub/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/better_errors-2.1.1/lib/better_errors/exception_extension.rb:10:in `set_backtrace'
from /home/jakub/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/web-console-2.0.0.beta3/lib/web_console/exception_extension.rb:15:in `call'
from /home/jakub/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/web-console-2.0.0.beta3/lib/web_console/exception_extension.rb:15:in `block in <class:Exception>'
from /home/jakub/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/better_errors-2.1.1/lib/better_errors/exception_extension.rb:10:in `set_backtrace'
from /home/jakub/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/web-console-2.0.0.beta3/lib/web_console/exception_extension.rb:15:in `call'
 ... 5885 levels...
from /home/jakub/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'

我的宝石文件:

    source 'https://rubygems.org'

gem 'rails',                                '4.2.2'
gem 'bcrypt',                                       '3.1.7'
gem "paperclip",
git: "git://github.com/thoughtbot/paperclip.git"
gem 'faker',                                        '1.4.2'
gem 'will_paginate',                        '3.0.7'
gem 'bootstrap-will_paginate',  '0.0.10'
gem 'sass-rails',                           '5.0.2'
gem 'uglifier',                             '2.5.3'
gem 'coffee-rails',                         '4.1.0'
gem 'jquery-rails',                         '4.0.3'
gem 'turbolinks',                           '2.3.0'
gem 'jbuilder',                             '2.2.3'
gem 'sdoc',                                 '0.4.0', group: :doc

group :development, :test do
  gem 'better_errors', '~> 2.1.1'
  gem 'sqlite3',     '1.3.9'
  gem 'byebug',      '3.4.0'
  gem 'web-console', '2.0.0.beta3'
  gem 'spring',      '1.1.3'
end

group :test do
  gem 'minitest-reporters', '1.0.5'
  gem 'mini_backtrace',     '0.1.3'
  gem 'guard-minitest',     '2.3.1'
end

group :production do
  gem 'pg',             '0.17.1'
  gem 'rails_12factor', '0.0.2'
end

1 个答案:

答案 0 :(得分:1)

自2014年以来,这是github上的active issue。一种解决方法似乎是将gem 'better_errors'从您的Gemfile中移出developmenttesting组。

您也可以手动重新开始spring,这可能会解决您的问题:

cd /your/project
spring stop
...
spring start
...

在你的Gemfile中:

source 'https://rubygems.org'

gem 'rails', '4.2.2'
gem 'bcrypt', '3.1.7'
gem "paperclip",
git: "git://github.com/thoughtbot/paperclip.git"
gem 'better_errors', '~> 2.1.1'

group :development, :test do
  # ...
end

您可以尝试的其他事项:

  • 删除Gemfile.lock,保持Gemfile不变,然后重新运行bundle install。确保在执行此操作时未运行rails s
  • 从您的Gemfile中删除better_errors版本