1

我安装了 Ubuntu 10.04,然后将其升级到 12.04。从那里我按照本教程设置 RoR: http ://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

然而,我在这里是因为我已经花了超过 12 个小时与不同的错误消息作斗争,并且想开枪打人。

错误一:

greg2@greg-desktop:~/bballApp$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
greg2@greg-desktop:~/bballApp$ rails -v
/home/greg2/bballApp/Gemfile:3:in `evaluate': undefined method `ruby' for #<Bundler::Dsl:0xb7607a18> (NoMethodError)
from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:17:in `build'
from /usr/lib/ruby/vendor_ruby/bundler.rb:136:in `definition'
from /usr/lib/ruby/vendor_ruby/bundler.rb:124:in `load'
from /usr/lib/ruby/vendor_ruby/bundler.rb:107:in `setup'
from /usr/lib/ruby/vendor_ruby/bundler/setup.rb:7
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /home/greg2/bballApp/config/boot.rb:6
from script/rails:5:in `require'
from script/rails:5

错误2:

greg2@greg-desktop:~/bballApp$ bundle install
Your Ruby version is 1.8.7, but your Gemfile specified 1.9.3

所以,谷歌告诉我查看我的 .zshrc 文件并添加:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

我然后做了。

返回并得到相同的错误。所以我尝试了:

greg2@greg-desktop:~/bballApp$ rvm list
rvm rubies
   ruby-1.9.3-p194 [ i686 ]
=* ruby-1.9.3-p362 [ i686 ]

我正在和一个在 MAC 上运行它的朋友一起开发它。

这是我的宝石清单:

greg2@greg-desktop:~/bballApp$ gem list

*当地宝石*

actionmailer (3.2.11, 3.2.9.rc3)
actionpack (3.2.11, 3.2.9.rc3)
activemodel (3.2.11, 3.2.9.rc3)
activerecord (3.2.11, 3.2.9.rc3)
activeresource (3.2.11, 3.2.9.rc3)
activesupport (3.2.11, 3.2.9.rc3)
addressable (2.3.2)
arel (3.0.2)
bcrypt-ruby (3.0.1)
bourne (1.1.2)
builder (3.0.4)
bundler (1.3.0.pre.5, 1.2.3, 1.1.5)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.4.0)
erubis (2.7.0)
execjs (1.4.0)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
jquery-rails (2.1.4)
json (1.7.6)
mail (2.4.4)
metaclass (0.0.1)
mime-types (1.19)
mocha (0.10.5)
multi_json (1.5.0)
 polyglot (0.3.3)
rack (1.4.4, 1.4.3)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.2)
rails (3.2.11, 3.2.9.rc3)
railties (3.2.11, 3.2.9.rc3)
rake (10.0.3)
rdoc (3.12)
sass (3.2.5)
sass-rails (3.2.6)
sprockets (2.2.2)
sqlite3 (1.3.7)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.12)
tzinfo (0.3.35)
uglifier (1.3.0)

这是我运行 rails 时发生的情况。

greg2@greg-desktop:~/bballApp$ rails s
/home/greg2/bballApp/Gemfile:3:in `evaluate': undefined method `ruby' for #<Bundler::Dsl:0xb765fa10> (NoMethodError)
from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:17:in `build'
from /usr/lib/ruby/vendor_ruby/bundler.rb:136:in `definition'
from /usr/lib/ruby/vendor_ruby/bundler.rb:124:in `load'
from /usr/lib/ruby/vendor_ruby/bundler.rb:107:in `setup'
from /usr/lib/ruby/vendor_ruby/bundler/setup.rb:7
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /home/greg2/bballApp/config/boot.rb:6
from script/rails:5:in `require'
from script/rails:5
  • 我筋疲力尽,没有想法,如果你在威斯康星州,我会开车给你买啤酒来让它运行。谢谢您的帮助。;
4

1 回答 1

0

正如@Prakash Murty 所说,您似乎在 Gemfile 中定义了 ruby​​ 版本。此行用于 Heroku 指定您的 ruby​​ 版本。

如果你想使用它,你需要使用 bundler 版本 1.2.0。

更多信息在这里:https ://devcenter.heroku.com/articles/ruby-versions

但是,如果您不使用 heroku 来托管您的应用程序,我建议您删除 Gemfile 的这一行。

我希望这会有所帮助。

于 2013-01-15T08:14:52.687 回答