切换到rvm和rails 3后的Rake问题

时间:2011-06-06 00:03:08

标签: ruby-on-rails rake rvm

所以问题的症结在于,我在运行时遇到以下错误

rake -T

WARNING: Global access to Rake DSL methods is deprecated.  Please Include
    ...  Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method SeenicServer::Application#task called at /home/grantismo/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks'
rake aborted!
no such file to load -- parse_tree

很明显我做了,gem安装ParseTree。 运行gem list -d ParseTree会产生:

*** LOCAL GEMS ***

ParseTree (3.0.7)
    Author: Ryan Davis
    Rubyforge: http://rubyforge.org/projects/parsetree
    Homepage: http://rubyforge.org/projects/parsetree/
    Installed at: /home/grantismo/.rvm/gems/ruby-1.9.2-p180

    ParseTree is a C extension (using RubyInline) that extracts the
    parse tree for an entire class or a specific method and returns it
    as a s-expression (aka sexp) using ruby's arrays, strings, symbols,
    and integers

看起来我正在使用正确的rake

which rake

/home/grantismo/.rvm/gems/ruby-1.9.2-p180/bin/rake

我读过的大部分解释都说运行sudo gem install ParseTree,但是如果我通过rvm管理宝石,我不明白为什么要安装sudo。

有什么想法吗?我是一个unix noob,所以它可能很简单。谢谢你的时间。

1 个答案:

答案 0 :(得分:3)

您需要确保Gemfile中有gem 'ParseTree'行,否则Rails将无法加载它(即使系统安装了它)。

添加该行后,请执行bundle install