1

由于我安装了 better_errors gem,我无法使用命令 rails 服务器启动我的服务器。我曾尝试在我的 development.rb 中添加行,例如BetterErrors::Middleware.allow_ip! "0.0.0.0/0"orBetterErrors::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'

还有我的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 '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
4

1 回答 1

1

自 2014 年以来,这是 github 上的一个活跃问题。一种解决方法似乎是从 Gemfile 中移出gem 'better_errors'development组。testing

您也可以开始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 原样并重新运行捆绑安装。确保rails s在执行此操作时未运行。
  • better_errors从您的 Gemfile 中删除版本
于 2015-10-16T08:51:22.190 回答