我正在尝试使用bundle exec rake asset:precompile在生产服务器上预编译我的资产。什么时候运行rake,我得到下面的错误。是什么造成的?
[x]$ bundle exec rake asset:precompile
/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby /home/admin/ento/vendor/bundle/ruby/1.9.1/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
database configuration specifies nonexistent mysql adapter
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:133:in `establish_connection'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/railtie.rb:82:in `block (2 levels) in <class:Railtie>'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:26:in `block in on_load'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:25:in `each'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/railtie.rb:74:in `block in <class:Railtie>'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/admin/ento/config/environment.rb:5:in `<top (required)>'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:103:in `require_environment!'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/sprockets/assets.rake:93:in `block (2 levels) in <top (required)>'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
Tasks: TOP => environment
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/...]
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/home/admin/ento/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
的Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.11'
group :development do
gem 'sqlite3'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'mysql'
end
gem 'jquery-rails'
group :production do
gem 'mysql'
gem 'activerecord-mysql-adapter'
end
gem 'devise'
gem 'paper_trail'
gem 'ckeditor_rails'
gem 'bootstrap-sass'
gem 'bootstrap-datepicker-rails'
gem 'carrierwave'
gem 'ransack'
gem 'nested_form'
gem 'mysql'
gem 'will_paginate'
gem 'capistrano'
gem 'therubyracer'
gem 'best_in_place'
的database.yml
production:
adapter: mysql
host: localhost
database: xxxx
username: xxxx
password: xxxx
timeout: 5000
答案 0 :(得分:1)
不确定这是解决方案,但对于更新的Rails应用程序,您可能希望使用mysql2 gem。看起来你还在旧宝石上。