新手问题 rake db:migrate 报错

wison · 2013年11月10日 · 最后由 zhangyanan 回复于 2013年11月19日 · 3180 次阅读

跟着 web 开发敏捷之道第三版这本书学习,好不容易一天时间折腾好了环境,照着书依葫芦画瓢。 跑到这一步得时候报错了。。 rake db:migrate

 rake db:migrate
/home/wison/.rvm/gems/ruby-1.8.7-p374@global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `setup': undefined method `name' for #<Array:0xb7176c60> (NoMethodError)
    from /home/wison/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `map'
    from /home/wison/.rvm/gems/ruby-1.8.7-p374@global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `each'
    from /home/wison/.rvm/gems/ruby-1.8.7-p374@global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `map'
    from /home/wison/.rvm/gems/ruby-1.8.7-p374@global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:75:in `setup'
    from /home/wison/.rvm/gems/ruby-1.8.7-p374@global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:114:in `check'
    from /home/wison/.rvm/gems/ruby-1.8.7-p374@global/gems/rubygems-bundler-1.4.2/lib/rubygems-bundler/noexec.rb:121
    from /home/wison/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /home/wison/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /home/wison/.rvm/gems/ruby-1.8.7-p374@global/gems/rubygems-bundler-1.4.2/lib/rubygems_executable_plugin.rb:4
    from /home/wison/.rvm/gems/ruby-1.8.7-p374@global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:50:in `call'
    from /home/wison/.rvm/gems/ruby-1.8.7-p374@global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:50:in `run'
    from /home/wison/.rvm/gems/ruby-1.8.7-p374@global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:49:in `each'
    from /home/wison/.rvm/gems/ruby-1.8.7-p374@global/gems/executable-hooks-1.2.6/lib/executable-hooks/hooks.rb:49:in `run'
    from /home/wison/.rvm/gems/ruby-1.8.7-p374/bin/ruby_executable_hooks:10

不知道为什么。盼高手予以解答。 gem list

*** LOCAL GEMS ***

actionmailer (2.2.2) actionpack (2.2.2) activerecord (2.2.2) activeresource (2.2.2) activesupport (2.2.2) bundler (1.3.5) bundler-unload (1.0.2) executable-hooks (1.2.6) rails (2.2.2) rake (0.8.3) ref (1.0.5) rubygems-bundler (1.4.2) rubygems-update (2.1.10, 1.3.7, 1.3.5) rvm (1.11.3.8) sqlite3 (1.3.8) sqlite3-ruby (1.3.3)

匿名 #1 2013年11月10日

码农的第六感:新添加的 migration 中可能有单词拼写错误。

@Turristan 但是,我执行 rake -v 还是报这个错

匿名 #3 2013年11月10日

@wison 亲,该升级了 Ruby Rails 的版本了。你的那本书,貌似是 07 年的,太旧了。英语不错的话试试Jump Start Rails吧。

@Turristan 哈哈,是得,这是我 10 年得时候买得,但是自己英文不行,不知道有没有比较新得中文书籍推荐?

匿名 #5 2013年11月10日

还是老老实实边看 Jump Start Rails 边学英语吧。英语不给力,想深入了解 Rails 是很头疼的。

试试: $ rvm @global $ gem uninstall bundler. 参考http://stackoverflow.com/questions/19849978/any-rails-command-gives-noexec-rb75in-setup-undefined-method-name 英语不给里,主要是搜 stackoverflow 会比较头疼

http://railstutorial-china.org 推荐你这本中文教材。根据最新的 rails 4 来的,而且明确规定了使用的各个 gem 的版本,我也是照着书里画瓢的,目前画到第九章,一个错误没有,一激动,就通过 paypal 支付买了正版。 #4 楼 @wison

你的 rails 版本是不是太低了?

需要 登录 后方可回复, 如果你还没有账号请 注册新账号