Rake 0.8.7 和 ActiveSupport 3.0.1

发布于 2024-09-27 21:53:36 字数 1615 浏览 2 评论 0原文

我正在运行 Ruby 1.9.2。我安装了 rake 0.8.7。然而,在 Rails 应用程序中运行 rake 会得到以下结果:

(in /usr/home/users/dimitar/Rails/spek)
Could not find activesupport-3.0.1 in any of the sources
Try running `bundle install`.

所以我继续运行 bundle install ,一切看起来都不错:

Fetching source index for http://rubygems.org/
Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.1) 
Using builder (2.1.2) 
Using i18n (0.4.1) 
Using activemodel (3.0.1) 
Using erubis (2.6.6) 
Using rack (1.2.1) 
Using rack-mount (0.6.13) 
Using rack-test (0.5.6) 
Using tzinfo (0.3.23) 
Using actionpack (3.0.1) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.8) 
Using mail (2.2.7) 
Using actionmailer (3.0.1) 
Using arel (1.0.1) 
Using activerecord (3.0.1) 
Using activeresource (3.0.1) 
Using bundler (1.0.3) 
Using thor (0.14.3) 
Using railties (3.0.1) 
Using rails (3.0.1) 
Using sqlite3-ruby (1.3.1) 
Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed.

但是 rake 仍然给了我同样的错误消息。有什么建议吗?


实际上问题似乎来自 config/boot.rb 文件:

# Set up gems listed in the Gemfile.                                                                                                                               
gemfile = File.expand_path('../../Gemfile', __FILE__)
begin
  ENV['BUNDLE_GEMFILE'] = gemfile
  require 'bundler'
  Bundler.setup
rescue Bundler::GemNotFound => e
  STDERR.puts e.message
  STDERR.puts "Try running `bundle install`."
  exit!
end if File.exist?(gemfile)

I am running Ruby 1.9.2. I have rake 0.8.7 installed. However running rake inside a Rails application gives me the following:

(in /usr/home/users/dimitar/Rails/spek)
Could not find activesupport-3.0.1 in any of the sources
Try running `bundle install`.

So I go ahead and run bundle install again and everything looks good:

Fetching source index for http://rubygems.org/
Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.1) 
Using builder (2.1.2) 
Using i18n (0.4.1) 
Using activemodel (3.0.1) 
Using erubis (2.6.6) 
Using rack (1.2.1) 
Using rack-mount (0.6.13) 
Using rack-test (0.5.6) 
Using tzinfo (0.3.23) 
Using actionpack (3.0.1) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.8) 
Using mail (2.2.7) 
Using actionmailer (3.0.1) 
Using arel (1.0.1) 
Using activerecord (3.0.1) 
Using activeresource (3.0.1) 
Using bundler (1.0.3) 
Using thor (0.14.3) 
Using railties (3.0.1) 
Using rails (3.0.1) 
Using sqlite3-ruby (1.3.1) 
Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed.

But rake still gives me the same error message. Any suggestions?


Actually the problem seems to come from the config/boot.rb file:

# Set up gems listed in the Gemfile.                                                                                                                               
gemfile = File.expand_path('../../Gemfile', __FILE__)
begin
  ENV['BUNDLE_GEMFILE'] = gemfile
  require 'bundler'
  Bundler.setup
rescue Bundler::GemNotFound => e
  STDERR.puts e.message
  STDERR.puts "Try running `bundle install`."
  exit!
end if File.exist?(gemfile)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

心如狂蝶 2024-10-04 21:53:36

您是否安装了多个 Ruby 解释器(可能通过 rvm 或其他方法)?如果是这样,您确定正确的选项处于活动状态吗?

看点:

which ruby
which rake
ruby -e 'puts $:' # To show the LOAD_PATH for gems

Do you have multiple Ruby interpreters installed (maybe via rvm or some other method)? If so, are you sure that the right one is active?

Things to look at:

which ruby
which rake
ruby -e 'puts $:' # To show the LOAD_PATH for gems
梦萦几度 2024-10-04 21:53:36

我使用 ruby​​-1.9.2 遇到了类似的问题,并通过升级 ruby​​gems

sudo gem update --system修复了它

I had a similar problem using ruby-1.9.2 and fixed it by upgrading rubygems

sudo gem update --system

椵侞 2024-10-04 21:53:36

我在使用 REE 1.8.7 时遇到了同样的问题。我切换到 1.9.2 并进行捆绑安装。然后我的 rake 命令起作用了。

I had the same problem when I was using REE 1.8.7. I switched to 1.9.2 and did bundle install. Then my rake commands worked.

长梦不多时 2024-10-04 21:53:36

当我错误地使用 ruby​​ 1.9.3 运行乘客并且该应用程序在其 .rvmrc 中使用 1.8.7 时,我遇到了这个问题。使用 1.9.3 修复了(现在我遇到了编码问题,但那是另一个故事了)。

I had this issue when I mistakenly ran passenger with ruby 1.9.3 and the app used 1.8.7 in its .rvmrc. Fixed by using 1.9.3 (now I have encoding problems, but thats a different story).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文