无法运行“rake db:migrate”在克隆的 github 存储库上
由于我是 Rails 新手,并且已经从书籍中学习了基础知识,所以我现在认为通过阅读其他人的代码并尝试理解它可以学到更多东西,因此我在 github 上注册并在那里设置了所有内容。现在我读到一个值得学习的优秀开源项目是 radiant,所以我去了 https://github.com/radiant /radiant 并将其克隆到本地目录。然后我按照以下步骤进行:
cd radiant
bundle install
,一切顺利rake db:migrate
,它首先返回:
耙子中止!您已经激活了 rake 0.9.2,但您的 Gemfile 需要 rake 0.8.7。使用bundle exec 可能会解决
所以我输入bundle exec rake db:migrate
并收到以下内容:
注意:Gem.source_index 已弃用,请使用规范。将于 2011 年 11 月 1 日或之后删除。从 c:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/rails/gem_dependency 调用 Gem.source_index Rake 中止!没有要加载的文件--radius
所以我想知道如何解决这个问题?我还注意到克隆时 radiant 文件夹中已经存在 Gemfile 和 Gemfile.lock,这可能是问题的一部分?
另外我想知道我运行与项目编写相同版本的 Rails 是否至关重要?
现在应该说我目前已经安装了 Rails 3.0.5 并在 Windows 上运行
我希望有人可以帮助我,因为我无法运行任何克隆的 github 存储库(这里辐射只是一个例子),这非常令人沮丧)。
Since I am new to rails and have learned the very basics from books I now figured that I can learn quite a bit more from reading other peoples code and trying to make sense of it so I have signed up at github and set up everything there. Now I read that one good open source project to learn from is radiant so I went to https://github.com/radiant/radiant and cloned it to a local directory. THen I proceeded as follows:
cd radiant
bundle install
, which went finerake db:migrate
, which first returned:
rake aborted! You have already activated rake 0.9.2, but your Gemfile requires rake 0.8.7. Using bundle exec may sol
So I typed in bundle exec rake db:migrate
and recieved the following:
NOTE: Gem.source_index is deprecated, use specification. It will be removed on or after 2011-11-01. Gem.source_index called from c:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/rails/gem_dependency Rake aborted! No such file to load -- radius
So here I am wondering how to fix this problem? I also noticed that a Gemfile and a Gemfile.lock already existed in the radiant folder when it was cloned, which perhaps could be part of the problem?
Also I wonder if it is crutial that I run the same version of rails as the project is written in?
Now it should be said that I currently have rails 3.0.5 installed and run on windows
I hope someone can help me here, it has been quite frustrating since I have not been able to run any cloned github repos (radiant here just being one example).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该编辑您的
Gemfile
并使其需要更新的 rake。您还可以运行 rake db:migrate --trace 来获取其他错误信息。
You should edit your
Gemfile
and make it require newer rake.Also you can run
rake db:migrate --trace
to get additional error information.弃用警告仍然只是一个警告,它不会给您带来任何问题。该错误的相关部分是
No such file to load -- radius
。您可能需要按照安装 Radiant 的说明进行操作,其中包括在将此项目代码放到某处之前运行gem install radiant
。Bundler 管理 Gemfile 中 gem 的安装和使用,如果存在 Gemfile.lock,它将使用这些确切的版本。这意味着您无法使用 Rails 3.0.5 运行 Radiant,因为 Gemfile 指定了 2.3.14。不过,Bundler 会自动安装 Rails 2.3.14 及其依赖项,因此您无需担心。
顺便说一句,这个项目看起来管理得很不善。 Rails 项目/gem 强迫您实际克隆它来使用它的情况并不常见。如果您想查看一个 Rails 3 项目来学习,我有一个精简的 Rails 3 应用程序,旨在成为 Github 上公开的 API,其中包含一些非常干净的代码:http://github.com/coreyward/instavibe
The deprecation warning is still just a warning, and it shouldn't be causing you any issues. The part of that error that is relevant is the
No such file to load -- radius
. You probably need to follow the instructions for installing Radiant, which include running agem install radiant
before dropping this project code somewhere.Bundler manages installing and using the gems in your Gemfile, and if a Gemfile.lock is present it'll use those exact versions. This means you can't run Radiant with Rails 3.0.5 since the Gemfile specifies 2.3.14. Bundler will install Rails 2.3.14 and its dependencies automatically, though, so you don't need to worry about it.
By the way, this project looks like it has been very mismanaged. It's not common for a Rails project/gem to force you to actually clone it to use it. If you want to check out a Rails 3 project to learn from, I have a slim Rails 3 app that was intended to be an API up publicly on Github with some really clean code: http://github.com/coreyward/instavibe