rake undefined方法`gsub'代表nil:NilClass

时间:2012-09-10 16:18:55

标签: ruby-on-rails-3 rake

我希望有人在这里有一些鼓励性的话和一些建议。

我正在使用Ruby v1.9.2 p290

我一直在设置一个新的生产服务器,我正在努力让新环境正常工作。一切都已安装,现在我正在尝试运行rake,但它给了我一个我无法理解的错误,也无法找到任何互联网帮助。

deploy@ip-10-99-66-30:~/pm$ rake -v --trace
rake aborted!
undefined method `gsub' for nil:NilClass
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:77:in `rescue in rescue in block in require'
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:72:in `rescue in block in require'
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:62:in `block in require'
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `require'
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.4/lib/bundler.rb:119:in `require'
/home/deploy/pm/config/application.rb:14:in `<top (required)>'
<internal:lib/rubygems/custom_require>:29:in `require'
<internal:lib/rubygems/custom_require>:29:in `require'
/home/deploy/pm/Rakefile:5:in `<top (required)>'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:495:in `raw_load_rakefile'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:78:in `block in load_rakefile'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:77:in `load_rakefile'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:61:in `block in run'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19:in `<main>'

这是我的宝石列表

actionmailer (3.1.0)
actionpack (3.1.0)
activemodel (3.1.0)
activerecord (3.1.0)
activeresource (3.1.0)
activesupport (3.1.0)
archive-tar-minitar (0.5.2)
arel (2.2.3)
bcrypt-ruby (3.0.1)
builder (3.0.0)
bundler (1.1.4)
cancan (1.6.8)
capybara (1.1.2)
childprocess (0.3.3)
client_side_validations (3.1.4)
cocaine (0.2.1)
coffee-rails (3.1.1)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
columnize (0.3.6)
cucumber (1.2.1)
cucumber-rails (1.3.0)
daemon_controller (1.0.0)
database_cleaner (0.8.0)
devise (1.5.3)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.4.0)
factory_girl (3.5.0)
factory_girl_rails (3.5.0)
faker (1.0.1)
fastthread (1.0.7)
ffi (1.0.11)
geocoder (1.1.2)
gherkin (2.11.1)
guard (1.2.3)
guard-rspec (1.2.0)
haml (3.1.6)
haml-rails (0.3.4)
hike (1.2.1)
hpricot (0.8.6)
httparty (0.8.3)
i18n (0.6.0)
journey (1.0.4)
jquery-rails (1.0.19)
json (1.7.3)
json_pure (1.7.3)
jsonify (0.3.1)
jsonify-rails (0.3.2)
libv8 (3.3.10.4 x86_64-linux)
linecache19 (0.5.12)
listen (0.4.7)
mail (2.3.3)
meta_search (1.1.3)
mime-types (1.19)
minitest (1.6.0)
multi_json (1.3.6)
multi_xml (0.5.1)
mysql2 (0.3.11)
nokogiri (1.5.5)
orm_adapter (0.0.7)
paperclip (2.7.0)
passenger (3.0.17)
polyamorous (0.5.0)
polyglot (0.3.3)
rack (1.3.6)
rack-cache (1.0.3)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.0)
rails3-jquery-autocomplete (1.0.7)
railties (3.1.0)
rake (0.9.2)
rb-fchange (0.0.5)
rb-fsevent (0.9.1)
rb-inotify (0.8.8)
rdoc (3.12, 2.5.8)
remotipart (1.0.2)
rspec (2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.3)
rspec-mocks (2.11.2)
rspec-rails (2.11.0)
ruby-debug-base19 (0.11.25)
ruby-debug19 (0.11.6)
ruby_core_source (0.1.5)
ruby_parser (2.3.1)
rubyzip (0.9.9)
sass (3.1.20)
sass-rails (3.1.4)
selenium-webdriver (2.7.0)
sexp_processor (3.2.0)
simple_datatables (0.2.1)
sprockets (2.0.4)
therubyracer (0.10.1)
thor (0.14.6)
tilt (1.3.3)
timeliness (0.3.6)
treetop (1.4.10)
tzinfo (0.3.33)
uglifier (1.2.6)
validates_timeliness (3.0.12)
warden (1.2.1)
web-app-theme (0.8.0)
webrat (0.7.3)
will_paginate (3.0.3)
xpath (0.1.4)

我已经花了好几天的时间,拔掉头发后,头上没有多少头发。

有什么建议吗? Ruby on Rails是一个很好的平台,但是我很难理解这个。

3 个答案:

答案 0 :(得分:2)

通过执行以下操作将bundler gem更新到最新版本(回答时为1.2.3):

gem update bundler

为我解决了这个问题。好吧,它没有完全修复它,但它允许显示导致问题的实际错误消息。

答案 1 :(得分:1)

我的宝石出了问题。

更新捆绑包

正确阅读错误,它会告诉你哪个宝石是罪魁祸首。

事实并非所有的宝石都与操作系统兼容。

答案 2 :(得分:0)

似乎是与gem版本冲突和捆绑器吐出特别不透明的错误消息相关的问题。

请参阅: https://github.com/carlhuda/bundler/issues/1847

显然,这是在最新版本的Bundler中修补的。我目前有同样的问题,我正在研究它,但我希望这有助于指出你正确的方向。