我在运行Rake命令时遇到了错误。当我试图在我的Rails项目中加入时,我会得到一个错误,上面写着Could not find rake-10.1.1 in any of the sources。
我把Rake10.1.1放在我的Gemfile中,但是当我捆绑安装时,它似乎什么也不做。
我已经尝试卸载,然后在我的计算机的Ruby,RVM Ruby-2.1.0,RVM Ruby-2.1.0@全局,以及我为特定项目创建的RVM gem中安装Rake gem。我也尝试过删除Gemfile.lock,然后捆绑安装。
我尝试在多个不同的Ruby/gems文件(包括RVM )中手动从终端中运行rake。它给出了这个错误:
/Users/me/.rvm/gems/ruby-2.1.0/gems/rake-10.1.1/bin/rake ; exit; ~ me$ /Users/me/.rvm/gems/ruby-2.1.0/gems/rake-10.1.1/bin/rake ; exit; rake aborted! No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
我在我的项目中有一个Rakefile,并且尝试重命名它(Rakefile.rb,rakefile)。
当我运行Rake命令(如rake db:migrate )时,会得到以下错误:
拉克流产了!未定义的局部变量或方法在require‘/Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in
load_dependency' /Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:inload_dependency' /Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in/me/..rvm/gems/ruby-2中的config' for main:Object /Users/me/RailsProject/config/environment.rb:4:in’require' /Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in块.1.0/gems/railties-4.0.2/lib/rails/application.rb:189:inrequire_environment!' /Users/me/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:250:in块在run_tasks_blocks‘/Users/me/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:ineval' /Users/me/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in’任务中: TOP => db:migrate =>环境(参见使用-跟踪运行任务的完整跟踪)
在来到这里之前,我到处寻找解决办法,但我找不到。如果有人能在这个问题上给我一些建议,我将不胜感激。提前谢谢你。
发布于 2014-03-06 01:35:24
我不知道问题是什么,但我解决了它,通过创建一个新的宝石集,安装Rake,并使用它。我也从鲁比明转到了崇高。可能是Rubymine试图使用不同的宝石。小心那些IDE设置。
发布于 2014-02-06 01:27:05
看起来它很难找到依赖项。您用gem install rake在系统上安装了rake吗?如果不是,您将需要使用bundle exec rake。
https://stackoverflow.com/questions/21591985
复制相似问题