1

command を使用して localhost でアセットをプリコンパイルしようとしてbundle exec rake assets:precompileいます。出力は次のとおりです。

/Users/adam/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:197: warning: Insecure world writable dir /usr/local/mysql in PATH, mode 040777
/Users/adam/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler.rb:263: warning: Insecure world writable dir /usr/local/mysql in PATH, mode 040777
/Users/adam/.rvm/rubies/ruby-1.9.3-p385/bin/ruby /Users/adam/.rvm/gems/ruby-1.9.3-p385/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
/Users/adam/.rvm/gems/ruby-1.9.3-p385@global/gems/bundler-1.2.3/lib/bundler.rb:263: warning: Insecure world writable dir /usr/local/mysql in PATH, mode 040777
rake aborted!
Access denied for user 'root'@'localhost' (using password: YES)
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/mysql2-0.3.13/lib/mysql2/client.rb:58:in `connect'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/mysql2-0.3.13/lib/mysql2/client.rb:58:in `initialize'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/model_schema.rb:308:in `clear_cache!'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activerecord-3.2.12/lib/active_record/railtie.rb:97:in `block (2 levels) in <class:Railtie>'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:418:in `_run__4521211058967275969__prepare__3791545036321061180__callbacks'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/actionpack-3.2.12/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/actionpack-3.2.12/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.12/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/adam/rubydev/Fileito/config/environment.rb:5:in `<top (required)>'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `block in require'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:251:in `require'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.12/lib/rails/application.rb:103:in `require_environment!'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/railties-3.2.12/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/actionpack-3.2.12/lib/sprockets/assets.rake:93:in `block (2 levels) in <top (required)>'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/actionpack-3.2.12/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): [/Users/adam/.rvm/rubies/ruby-1.9.3-p385/b...]
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/actionpack-3.2.12/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/actionpack-3.2.12/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/actionpack-3.2.12/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `eval'
/Users/adam/.rvm/gems/ruby-1.9.3-p385/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

MySQL ではなく SQLite データベースを使用しています - アセットをプリコンパイルできないのはなぜですか?

4

2 に答える 2

1

この行をに追加しますconfig/application.rb

config.assets.initialize_on_precompile = false

これにより、Rails がアセットのプリコンパイル時に DB に接続できなくなります。

于 2013-09-23T09:54:39.867 に答える
-2

直したほうがいいと思う

ユーザー 'root'@'localhost' に対して拒否されました

データベース構成ファイルを確認し、データベース接続の問題を修正してから、アセットをプリコンパイルします

于 2013-09-23T09:47:57.450 に答える