2013-02-06 83 views
0

我正在一個CentOS 6.3 Linux服務器和Ruby版本上:1.8.7和創業板的版本:25年8月1日管理平臺安裝用ActiveRecord-mysql的適配器

我試圖運行命令: ruby script/rails server webrick -e production

它吐出了這個錯誤:

=> Booting WEBrick 
=> Rails 3.2.8 application starting in production on http://0.0.0.0:3000 
=> Call with -d to detach 
=> Ctrl-C to shutdown server 
Exiting 
/usr/lib64/ruby/gems/1.8/gems/bundler-1.2.3/lib/bundler/rubygems_integration.rb:157:in `gem': Please install the mysql adapter: `gem install activerecord-mysql-adapter` (can't activate mysql (~> 2.8.1), already activated mysql-2.9.0. Make sure all dependencies are added to Gemfile.) (LoadError) 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/mysql_adapter.rb:5 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:41:in `resolve_string_connection' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:25:in `spec' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:129:in `establish_connection' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/railtie.rb:82 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:43:in `run_load_hooks' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `each' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/base.rb:721 
    from /var/www/redmine/lib/plugins/acts_as_activity_provider/init.rb:2 
    from /var/www/redmine/config/initializers/00-core_plugins.rb:12 
    from /var/www/redmine/config/initializers/00-core_plugins.rb:2:in `each' 
    from /var/www/redmine/config/initializers/00-core_plugins.rb:2 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:588 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:587:in `each' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:587 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `run_initializers' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `send' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing' 
    from /var/www/redmine/config/environment.rb:14 
    from /var/www/redmine/config.ru:4:in `require' 
    from /var/www/redmine/config.ru:4 
    from /usr/lib64/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `instance_eval' 
    from /usr/lib64/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `initialize' 
    from /var/www/redmine/config.ru:1:in `new' 
    from /var/www/redmine/config.ru:1 

這是我的Gemfile:

source 'http://rubygems.org' 

gem 'rails', '3.2.8' 
gem "jquery-rails", "~> 2.0.2" 
gem "i18n", "~> 0.6.0" 
gem "coderay", "~> 1.0.6" 
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby] 
gem "builder", "3.0.0" 
gem "rake", "0.8.7" 
gem "rack", "1.4.0" 
gem "rubytree", "0.5.2", :require => "tree" 
gem "RedCloth", "~>4.2.3", :require => "redcloth" # for CodeRay 
gem "mysql", "2.9.0" 

# Optional gem for LDAP authentication 
group :ldap do 
    gem "net-ldap", "~> 0.3.1" 
end 

# Optional gem for OpenID authentication 
group :openid do 
    gem "ruby-openid", "~> 2.1.4", :require => "openid" 
    gem "rack-openid" 
end 

# Optional gem for exporting the gantt to a PNG file, not supported with jruby 
platforms :mri, :mingw do 
    group :rmagick do 
    # RMagick 2 supports ruby 1.9 
    # RMagick 1 would be fine for ruby 1.8 but Bundler does not support 
    # different requirements for the same gem on different platforms 
    gem "rmagick", ">= 2.0.0" 
    end 
end 

# Database gems 
platforms :mri, :mingw do 
    group :postgresql do 
    gem "pg", ">= 0.11.0" 
    end 

    group :sqlite do 
    gem "sqlite3" 
    end 
end 

platforms :mri_18, :mingw_18 do 
    group :mysql do 
    gem "mysql", "2.9.0" 
    end 
end 

platforms :mri_19, :mingw_19 do 
    group :mysql do 
    gem "mysql2", "~> 0.3.11" 
    end 
end 

platforms :jruby do 
    gem "jruby-openssl" 

    group :mysql do 
    gem "activerecord-jdbcmysql-adapter" 
    end 

    group :postgresql do 
    gem "activerecord-jdbcpostgresql-adapter" 
    end 

    group :sqlite do 
    gem "activerecord-jdbcsqlite3-adapter" 
    end 
end 

group :development do 
    gem "rdoc", ">= 2.4.2" 
    gem "yard" 
end 

group :test do 
    gem "shoulda", "~> 2.11" 
    # Shoulda does not work nice on Ruby 1.9.3 and seems to need test-unit explicitely. 
    gem "test-unit", :platforms => [:mri_19] 
    gem "mocha", "0.12.3" 
end 

local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local") 
if File.exists?(local_gemfile) 
    puts "Loading Gemfile.local ..." if $DEBUG # `ruby -d` or `bundle -v` 
    instance_eval File.read(local_gemfile) 
end 

# Load plugins' Gemfiles 
Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file| 
    puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v` 
    instance_eval File.read(file) 
end 

我已經安裝了activerecord-mysql-adapter - 它沒有錯誤...

我試着改變Gemfile以匹配它吐出的錯誤(〜> 2.8.1)版本,但是沒有工作要麼...

任何幫助真的會感激...

更新!

我卸載的MySQL 2.9.0和安裝了MySQL 2.8.1和改變了我的Gemfile以反映正確的版本,但現在我得到這個錯誤:

=> Booting WEBrick 
=> Rails 3.2.8 application starting in production on http://0.0.0.0:3000 
=> Call with -d to detach 
=> Ctrl-C to shutdown server 
Exiting 
/usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `query': Mysql::Error: Table 'redmine.users' doesn't exist: SHOW FULL FIELDS FROM `users` (ActiveRecord::StatementInvalid) 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `execute' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `log' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `execute' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/mysql_adapter.rb:324:in `execute_and_free' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:426:in `columns' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/schema_cache.rb:12:in `initialize' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in `call' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in `default' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in `[]' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in `columns' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:237:in `columns_hash' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/inheritance.rb:19:in `descends_from_active_record?' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/inheritance.rb:25:in `finder_needs_type_condition?' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/base.rb:455:in `relation' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/scoping/named.rb:37:in `scoped' 
    from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/querying.rb:9:in `order' 
    from /var/www/redmine/app/models/group.rb:32 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:359:in `require_or_load' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:313:in `depend_on' 
    from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:225:in `require_dependency' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:439:in `eager_load!' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:438:in `each' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:438:in `eager_load!' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:436:in `each' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:436:in `eager_load!' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/application/finisher.rb:53 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `run_initializers' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `send' 
    from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing' 
    from /var/www/redmine/config/environment.rb:14 
    from /var/www/redmine/config.ru:4:in `require' 
    from /var/www/redmine/config.ru:4 
    from /usr/lib64/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `instance_eval' 
    from /usr/lib64/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `initialize' 
    from /var/www/redmine/config.ru:1:in `new' 
    from /var/www/redmine/config.ru:1 

編輯:我想通了.. 。我需要運行命令:RAILS_ENV=production bundle exec rake db:migrate

DOH!

回答

0

嘗試

bundle exec ruby script/rails server webrick -e production 

而且,你爲什麼要使用腳本/導軌上?這應該工作:

bundle exec rails server webrick -e production 

HTH

+0

我試過了,仍然得到了一個錯誤......似乎是同樣的事情。我把該行直接從安裝說明書上的技術管理平臺網站 – Angela

+0

你運行:軟件包更新? – rainkinz

+0

至於你的更新。你運行rake db:migrate?您是否確定要在生產環境中運行它?如果你確定那麼你可能需要rake db:migrate RAILS_ENV = production。 – rainkinz