奇怪的Ruby on Rails的错误 [英] Weird Ruby on Rails Error

查看:111
本文介绍了奇怪的Ruby on Rails的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我跑捆绑安装然后轨道小号有一天,得到了以下错误:

<$p$p><$c$c>/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activerecord-1.6.0/lib/active_record/support/clean_logger.rb:5:in `remove_const:不断记录仪::格式没有定义(NameError)

我读过,我可以通过进入 clean_logger.rb 文件,并注释掉该行解决这个问题,但我从来没有碰过的文件,我不吨要修改它,如果我能帮助它。有谁知道这是什么文件呢还是我怎么能解决这个问题?我使用Ruby 1.9.2和Rails 3.1.0.rc4。

更新

下面是我的Gemfile:

 来源http://rubygems.org

创业板轨

宝石'sqlite3的'

#资产模板引擎
创业板上海社会科学院护栏,GT〜&; 3.1.0.rc
创业板咖啡脚本
创业板uglifier

#的JavaScript
创业板的jQuery护栏

#CSS
创业板的指南针,:混帐=&GT; https://github.com/chriseppstein/compass.git:支=&GT; rails31

#认证
创业板authlogic

#使用麒麟作为Web服务器
#宝石'麒麟'

#部署与斯特拉努
#创业板Capistrano的'

#要使用调试器
#宝石红宝石debug19',:要求=&GT; 红宝石调试

#分页
创业板will_paginate

组:发展做
  创业板RSpec的护栏
  创业板注释,型号
  创业板RB-fsevent#:要求=&GT; (RUBY_PLATFORM =〜/达尔文/ I)
  创业板后卫RSpec的
  创业板骗子
  创业板word_salad
结束

组:测试做
  #pretty的打印测试输出
  宝石'转',:要求=&GT;假
  创业板RSpec的
  创业板webrat
  创业板factory_girl_rails
结束

组:部署做
  创业板的Heroku
结束
 

更新2

按照注释中的要求:

.rvmrc

 (空)
 

RVM信息

  ruby​​-1.9.2-p180@rails31:

  系统:
    UNAME:达尔文Big.local 10.7.0 Darwin内核版本10.7.0:星期六1月29日15时17分16秒的PST 2011;根:XNU-1504.9.37〜1 / RELEASE_I386 I386
    庆典:/斌/ bash的=&GT; GNU bash中,版本3.2.48(1) - 释放下(x86_64-苹果darwin10.0)
    zsh的:/ bin中/ zsh的=&GT;的zsh 4.3.9(I386-苹果darwin10.0)

  RVM:
    版本:RVM 1.6.20由韦恩·E.塞甘(wayneeseguin@gmail.com)[https://rvm.beginrescueend.com/]

  红宝石:
    除preTER:红宝石
    版本:1.9.2p180
    日期:2011-02-18
    平台:x86_64的,darwin10.7.0
    补丁级别:2011-02-18改版30909
    full_version:红宝石1.9.2p180(2011-02-18改版30909)的x86_64-darwin10.7.0]

  房屋:
    创业板:/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31
    红宝石:/Users/helixed/.rvm/rubies/ruby-1.9.2-p180

  二进制文件:
    红宝石:/Users/helixed/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
    IRB:/Users/helixed/.rvm/rubies/ruby-1.9.2-p180/bin/irb
    创业板:/Users/helixed/.rvm/rubies/ruby-1.9.2-p180/bin/gem
    耙:/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31/bin/rake

  环境:
    路径: "/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31/bin:/Users/helixed/.rvm/gems/ruby-1.9.2-p180@global/bin:/Users/helixed/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/helixed/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin"
    GEM_HOME:/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31
    GEM_PATH:/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31:/Users/helixed/.rvm/gems/ruby-1.9.2-p180@global
    MY_RUBY_HOME:/Users/helixed/.rvm/rubies/ruby-1.9.2-p180
    IRBRC:/Users/helixed/.rvm/rubies/ruby-1.9.2-p180/.irbrc
    RUBYOPT:
    宝石:rails31
 

创业板上市

  ***当地的宝石***

的ActionMailer(3.1.0.rc4,0.6.1)
ActionPack的(3.1.0.rc4)
activemodel的(3.1.0.rc4)
ActiveRecord的(3.1.0.rc4,1.6.0)
的ActiveResource(3.1.0.rc4)
的ActiveSupport(3.1.0.rc4)
注释-模型(1.0.4)
ANSI(1.2.5)
AREL(2.1.1)
authlogic(3.0.3,2.1.6)
bcrypt-红宝石(2.1.4)
蓝图轨(0.1.1)
建设者(3.0.0)
打捆(1.0.15)
chunky_png(1.2.0)
咖啡脚本(2.2.0)
咖啡脚本源(1.1.1)
指南针(0.11.3)
指南针-960-插件(0.10.4)
配置(1.3.1)
差异-LCS(1.1.2)
erubis(2.7.0)
execjs(1.2.0)
factory_girl(1.3.3)
factory_girl_rails(1.0.1)
骗子(0.9.5)
fssm(0.2.7)
后卫(0.4.2)
后卫RSpec的(0.4.0)
Heroku的(2.3.4,2.3.3)
加息(1.1.0)
国际化(0.6.0)
jQuery的护栏(1.0.12,1.0.11)
launchy(0.4.0)
邮件(2.3.0)
MIME类型(1.16)
multi_json(1.0.3)
引入nokogiri(1.4.6)
通晓(0.3.1)
机架(1.3.0)
机架缓存(1.0.2)
机架安装(0.8.1)
机架SSL(1.3.2)
架测试(0.6.0)
导轨(3.1.0.rc4,0.9.5)
railties(3.1.0.rc4)
耙(0.9.2,0.8.7)
RB-fsevent(0.4.0)
RDOC(3.6.1)
其余客户端(1.6.3)
RSpec的(2.6.0)
RSpec的核心(2.6.4)
RSpec的期许(2.6.0)
RSpec的-嘲笑(2.6.0)
RSpec的护栏(2.6.1)
SASS(3.1.3)
上海社会科学院护栏(3.1.0.rc.3,3.1.0.rc.2)
链轮(2.0.0.beta.10)
sqlite3的(1.3.3)
学期ansicolor(1.0.5)
雷神(0.14.6)
倾斜(1.3.2)
树梢(1.4.9)
转(0.8.2)
tzinfo(0.3.28)
uglifier(1.0.0,0.5.4)
webrat(0.7.3)
will_paginate(2.3.15)
word_salad(2.0.0)
 

解决方案

由于某些原因,你要安装一个古老版本的ActiveRecord的是失败的。

我会做的是首先检查你的的Gemfile.lock 文件,看看有什么宝石指定一个旧版本的ActiveRecord的。 (请在该文件中搜索)。如果可以的话,注释掉的宝石,它使用旧的ActiveRecord从Gemfile文件,或使用宝石更现代版或更换,如果你需要它。 (从您的Gemfile的一个粗略的检查没有跳出我,也许你安装了一些旧的东西更早,去掉吗?)

如果你看不到的ActiveRecord在的Gemfile.lock规定的1.6版本,我就炸掉你的RVM宝石和命令行重新安装。你可能有一些旧的东西在里面无论出于何种原因。在项目目录中使用以下命令:

  $ RVM宝石空rails31

$ RVM宝石使用rails31

$创业板安装打捆

$捆绑安装
 

祝你好运!

I ran bundle install and then rails s the other day and got the following error:

/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31/gems/activerecord-1.6.0/lib/active_record/support/clean_logger.rb:5:in `remove_const': constant Logger::Format not defined (NameError)

I've read I can fix this by going into the clean_logger.rb file and commenting out that line, but I've never touched that file and I don't want to edit it if I can help it. Does anybody know what this file does or how I can fix this? I'm using Ruby 1.9.2 and Rails 3.1.0.rc4.

Update

Here's my Gemfile:

source 'http://rubygems.org'

gem 'rails'

gem 'sqlite3'

# Asset template engines
gem 'sass-rails', "~> 3.1.0.rc"
gem 'coffee-script'
gem 'uglifier'

# JavaScript
gem 'jquery-rails'

# CSS
gem 'compass', :git => "https://github.com/chriseppstein/compass.git", :branch => "rails31"

# Authentication
gem 'authlogic'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

# pagination
gem 'will_paginate'

group :development do
  gem 'rspec-rails'
  gem 'annotate-models'
  gem 'rb-fsevent'#, :require => (RUBY_PLATFORM =~ /darwin/i)
  gem 'guard-rspec'
  gem 'faker'
  gem 'word_salad'
end

group :test do
  # Pretty printed test output
  gem 'turn', :require => false
  gem 'rspec'
  gem 'webrat'
  gem 'factory_girl_rails'
end

group :deployment do
  gem 'heroku'
end

Update 2

As per the requests in the comments:

.rvmrc

(empty)

rvm info:

ruby-1.9.2-p180@rails31:

  system:
    uname:       "Darwin Big.local 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386 i386"
    bash:        "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)"
    zsh:         "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"

  rvm:
    version:      "rvm 1.6.20 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.2p180"
    date:         "2011-02-18"
    platform:     "x86_64-darwin10.7.0"
    patchlevel:   "2011-02-18 revision 30909"
    full_version: "ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]"

  homes:
    gem:          "/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31"
    ruby:         "/Users/helixed/.rvm/rubies/ruby-1.9.2-p180"

  binaries:
    ruby:         "/Users/helixed/.rvm/rubies/ruby-1.9.2-p180/bin/ruby"
    irb:          "/Users/helixed/.rvm/rubies/ruby-1.9.2-p180/bin/irb"
    gem:          "/Users/helixed/.rvm/rubies/ruby-1.9.2-p180/bin/gem"
    rake:         "/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31/bin/rake"

  environment:
    PATH:         "/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31/bin:/Users/helixed/.rvm/gems/ruby-1.9.2-p180@global/bin:/Users/helixed/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/helixed/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin"
    GEM_HOME:     "/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31"
    GEM_PATH:     "/Users/helixed/.rvm/gems/ruby-1.9.2-p180@rails31:/Users/helixed/.rvm/gems/ruby-1.9.2-p180@global"
    MY_RUBY_HOME: "/Users/helixed/.rvm/rubies/ruby-1.9.2-p180"
    IRBRC:        "/Users/helixed/.rvm/rubies/ruby-1.9.2-p180/.irbrc"
    RUBYOPT:      ""
    gemset:       "rails31"

gem list:

*** LOCAL GEMS ***

actionmailer (3.1.0.rc4, 0.6.1)
actionpack (3.1.0.rc4)
activemodel (3.1.0.rc4)
activerecord (3.1.0.rc4, 1.6.0)
activeresource (3.1.0.rc4)
activesupport (3.1.0.rc4)
annotate-models (1.0.4)
ansi (1.2.5)
arel (2.1.1)
authlogic (3.0.3, 2.1.6)
bcrypt-ruby (2.1.4)
blueprint-rails (0.1.1)
builder (3.0.0)
bundler (1.0.15)
chunky_png (1.2.0)
coffee-script (2.2.0)
coffee-script-source (1.1.1)
compass (0.11.3)
compass-960-plugin (0.10.4)
configuration (1.3.1)
diff-lcs (1.1.2)
erubis (2.7.0)
execjs (1.2.0)
factory_girl (1.3.3)
factory_girl_rails (1.0.1)
faker (0.9.5)
fssm (0.2.7)
guard (0.4.2)
guard-rspec (0.4.0)
heroku (2.3.4, 2.3.3)
hike (1.1.0)
i18n (0.6.0)
jquery-rails (1.0.12, 1.0.11)
launchy (0.4.0)
mail (2.3.0)
mime-types (1.16)
multi_json (1.0.3)
nokogiri (1.4.6)
polyglot (0.3.1)
rack (1.3.0)
rack-cache (1.0.2)
rack-mount (0.8.1)
rack-ssl (1.3.2)
rack-test (0.6.0)
rails (3.1.0.rc4, 0.9.5)
railties (3.1.0.rc4)
rake (0.9.2, 0.8.7)
rb-fsevent (0.4.0)
rdoc (3.6.1)
rest-client (1.6.3)
rspec (2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
sass (3.1.3)
sass-rails (3.1.0.rc.3, 3.1.0.rc.2)
sprockets (2.0.0.beta.10)
sqlite3 (1.3.3)
term-ansicolor (1.0.5)
thor (0.14.6)
tilt (1.3.2)
treetop (1.4.9)
turn (0.8.2)
tzinfo (0.3.28)
uglifier (1.0.0, 0.5.4)
webrat (0.7.3)
will_paginate (2.3.15)
word_salad (2.0.0)

解决方案

For some reason, you are installing an ancient version of activerecord which is failing.

What I would do is first check your Gemfile.lock file to see what gem is specifying an old version of activerecord. (Do a search in that file.) If you can, comment out that gem which uses the old activerecord from the Gemfile or use a more modern version or replacement of that gem if you need it. (Nothing jumps out at me from a cursory examination of your Gemfile, maybe you installed some old stuff earlier and removed it?)

If you don't see version 1.6 of activerecord specified in the Gemfile.lock, I'd blow up your rvm gemset and install again from the command line. You probably have some old stuff in there for whatever reason. In your project directory use the following commands:

$ rvm gemset empty rails31

$ rvm gemset use rails31

$ gem install bundler

$ bundle install

Good luck!

这篇关于奇怪的Ruby on Rails的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆