2015-10-16 101 views
1

因爲我更喜歡better_errors寶石我無法使用命令欄服務器啓動我的服務器。我曾嘗試添加行到我的development.rb像BetterErrors::Middleware.allow_ip! "0.0.0.0/0"BetterErrors::Middleware.allow_ip! ENV['TRUSTED_IP'] if ENV['TRUSTED_IP'],但它沒有奏效。 這是我的錯誤訊息,當我嘗試啓動服務器:Rails better_errors寶石服務器不啓動

/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 

回答

1

這是在github的active issue自2014年一個解決辦法似乎是移動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不變,然後重新運行軟件包安裝。確保rails s不會在運行時運行。
  • 刪除better_errors版本從您的Gemfile
+0

是的,我刪除了我的Gemfile better_errors現在服務器工作,是否有可能使服務器工作,這種寶石? –

+0

是的,你可以簡單地把它放在其他寶石的下面,而不是使用gem'groups'。如果您仍在開發中,並且不在生產中爲您的應用程序提供服務,那麼這是一件合理的事情。 –