需要帮助解决 RAILS 3.0.9 迁移问题

发布于 2024-11-26 16:42:02 字数 3827 浏览 1 评论 0原文

我遇到了一些严重的 Rails 问题。我已经有一段时间没有使用它了,所以我检查并更新了 rvm、rails 等。我当前正在运行以下命令:

RVM -- rvm 1.6.25 by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com/]

RAILS -- Rails 3.0.9

RUBY -- ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]

我执行以下步骤:

rails new my_project

cd my_project

bundle install

rails g scaffold person first_name:string last_name:string

rake db:migrate

/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:4: warning: already initialized constant MAJOR
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:5: warning: already initialized constant MINOR
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:6: warning: already initialized constant BUILD
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:3: warning: already initialized constant NUMBERS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:9: warning: already initialized constant VERSION
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake.rb:26: warning: already initialized constant RAKEVERSION
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/early_time.rb:17: warning: already initialized constant EARLY
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/alt_system.rb:32: warning: already initialized constant WINDOWS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:28: warning: already initialized constant DEFAULT_RAKEFILES
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task_arguments.rb:73: warning: already initialized constant EMPTY_TASK_ARGS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/invocation_chain.rb:49: warning: already initialized constant EMPTY
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/dsl_definition.rb:143: warning: already initialized constant Commands
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:44: warning: already initialized constant ARRAY_METHODS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:47: warning: already initialized constant MUST_DEFINE
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:51: warning: already initialized constant MUST_NOT_DEFINE
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:55: warning: already initialized constant SPECIAL_RETURN
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:61: warning: already initialized constant DELEGATING_METHODS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:364: warning: already initialized constant DEFAULT_IGNORE_PATTERNS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:370: warning: already initialized constant DEFAULT_IGNORE_PROCS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake.rb:64: warning: already initialized constant FileList
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake.rb:65: warning: already initialized constant RakeFileUtils
rake aborted!
stack level too deep

提前致谢!

I'm having some serious rails issues. I haven't used it in quite some time so I went through and updated rvm, rails, etc. I'm currently running the following:

RVM -- rvm 1.6.25 by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com/]

RAILS -- Rails 3.0.9

RUBY -- ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]

I perform the following steps:

rails new my_project

cd my_project

bundle install

rails g scaffold person first_name:string last_name:string

rake db:migrate

/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:4: warning: already initialized constant MAJOR
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:5: warning: already initialized constant MINOR
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:6: warning: already initialized constant BUILD
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:3: warning: already initialized constant NUMBERS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:9: warning: already initialized constant VERSION
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake.rb:26: warning: already initialized constant RAKEVERSION
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/early_time.rb:17: warning: already initialized constant EARLY
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/alt_system.rb:32: warning: already initialized constant WINDOWS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:28: warning: already initialized constant DEFAULT_RAKEFILES
WARNING: Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already exists
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task_arguments.rb:73: warning: already initialized constant EMPTY_TASK_ARGS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/invocation_chain.rb:49: warning: already initialized constant EMPTY
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/dsl_definition.rb:143: warning: already initialized constant Commands
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:44: warning: already initialized constant ARRAY_METHODS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:47: warning: already initialized constant MUST_DEFINE
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:51: warning: already initialized constant MUST_NOT_DEFINE
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:55: warning: already initialized constant SPECIAL_RETURN
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:61: warning: already initialized constant DELEGATING_METHODS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:364: warning: already initialized constant DEFAULT_IGNORE_PATTERNS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:370: warning: already initialized constant DEFAULT_IGNORE_PROCS
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake.rb:64: warning: already initialized constant FileList
/Users/devuser/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake.rb:65: warning: already initialized constant RakeFileUtils
rake aborted!
stack level too deep

Thanks in advance!

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

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

发布评论

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

评论(2

两个我 2024-12-03 16:42:02

从我的博客复制的解决方案: http://joneslee85.wordpress.com/2011/07/29/howto-fix-rake-0-9-2-to-work-with-ruby-1-9-2-under- rvm/

最好的方法:
我不认为恢复到 0.8.7 是最好的答案,因为如果你使用 RVM 编译 1.9.2,你会遇到这个问题。以下是解决这个问题的方法:

  • gem list | grep 'rake',您将看到这个rake (0.9.2 ruby​​)。现在请仔细注意关键字“ruby”是作恶者,它实际上是@global文件夹中rake的重复。我认为这可能是 RVM 错误。
  • 现在我们需要删除 rake,请执行:gem uninstall rake,当它警告它将破坏依赖项时说 Y,如果它要求删除可执行文件“rake”,也说 Y。
  • 现在,再次检查gem list | grep 'rake' 你只会看到 rake (0.9.2)

这将解决这个问题。

第二种方法:恢复到 0.8.7

好的,您将无法卸载 rake 0.9.2,因为 RVM 将 rake 安装到了 @global 文件夹中。因此,您可以在安装 rake 0.8.7 之前手动删除 rake 0.9.2:

gem list -d rake

并注意 Installed at: /Users/mojo/.rvm/gems/ruby-1.9.2-p290@global< /em> 在输出中。你的将与我的不同,所以请注意,现在我们需要使用以下命令删除 rake:

注意:请确保使用 \ 转义字符 @

rm /Users/mojo/.rvm/gems/ruby-1.9.2-p290\@global/bin/rake
rm /Users/mojo/.rvm/gems/ruby-1.9.2-p290\@global/cache/rake-0.9.2.gem
rm -rf /Users/mojo/.rvm/gems/ruby-1.9.2-p290\@global/doc/rake-0.9.2/
rm -rf /Users/mojo/.rvm/gems/ruby-1.9.2-p290\@global/gems/rake-0.9.2/
rm /Users/mojo/.rvm/gems/ruby-1.9.2-p290\@global/specifications/rake-0.9.2.gemspec

接下来是使用 gem install rake -v= 安装 rake 0.8.7 0.8.7

Solution copied from my blog: http://joneslee85.wordpress.com/2011/07/29/howto-fix-rake-0-9-2-to-work-with-ruby-1-9-2-under-rvm/

BEST WAY:
I do not think reverting to 0.8.7 is the best answer because if you compile 1.9.2 with RVM, you will bump into this issue. Here is how to fix this babe:

  • gem list | grep 'rake' and you will see this rake (0.9.2 ruby). Now please carefully pay attention to the keyword "ruby" is the evil-doer, it's actually the duplication of rake in @global folder. I think this could be RVM bug.
  • Now we need to remove rake, please do: gem uninstall rake, say Y when it warns that it will break dependencies and also say Y if it asks to remove the executable 'rake'.
  • Now, check again gem list | grep 'rake' and you will simply see rake (0.9.2)

That would fix this issue.

SECOND WAY: Revert to 0.8.7

Okay, you WILL NOT be able to uninstall rake 0.9.2 because RVM installed rake into @global folder. So here is how you can delete rake 0.9.2 manually before installing rake 0.8.7:

gem list -d rake

and pay attention to the Installed at: /Users/mojo/.rvm/gems/ruby-1.9.2-p290@global in the output. Yours will differ from mine so please be aware, now we need to remove rake with following commands:

NOTE: make sure you escape the character @ with an \

rm /Users/mojo/.rvm/gems/ruby-1.9.2-p290\@global/bin/rake
rm /Users/mojo/.rvm/gems/ruby-1.9.2-p290\@global/cache/rake-0.9.2.gem
rm -rf /Users/mojo/.rvm/gems/ruby-1.9.2-p290\@global/doc/rake-0.9.2/
rm -rf /Users/mojo/.rvm/gems/ruby-1.9.2-p290\@global/gems/rake-0.9.2/
rm /Users/mojo/.rvm/gems/ruby-1.9.2-p290\@global/specifications/rake-0.9.2.gemspec

Next is to install rake 0.8.7 with gem install rake -v=0.8.7

九命猫 2024-12-03 16:42:02

删除 rake 0.9.2 并安装 rake 0.8.7 并查看是否有效。

众所周知,rake 0.9.x 分支可以完全破坏任何 Rails 安装。

Remove rake 0.9.2 and install rake 0.8.7 and see if it works.

The rake 0.9.x branch has been well known to break any rails install completely.

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