Heim > Fragen und Antworten > Hauptteil
1.相关环境: ubutu12.04 mysql5.5 ruby2.1 redmine3.3 gem 2.2.5
rails 4.2.6
2.redmin的配置文件配置如下:
database.yml:
production:
adapter: mysql2
database: redmine
host: 127.0.0.1
username: redmine
password: 123456
encoding: utf8
configuration.yml
default:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: 127.0.0.1
port: 25
authentication: :login
#domain: localhost
user_name: 'redmin@localhost'
password: '123456'
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: 127.0.0.1
port: 25
3.遇到的问题:
在初始化数据库,创建表使用该命令 RAILS_ENV=production rake db:migrate
出现报错:rake aborted!
NoMethodError: undefined method `address=' for ActionMailer::Base:Class
下面是详细的追踪的结果:
RAILS_ENV=production rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
NoMethodError: undefined method `address=' for ActionMailer::Base:Class
/usr/local/lib/ruby/gems/2.1.0/gems/actionmailer-4.2.6/lib/action_mailer/base.rb:569:in `method_missing'
/usr/local/src/redmine-3.3.0/lib/redmine/configuration.rb:57:in `block in load'
/usr/local/src/redmine-3.3.0/lib/redmine/configuration.rb:55:in `each'
/usr/local/src/redmine-3.3.0/lib/redmine/configuration.rb:55:in `load'
/usr/local/src/redmine-3.3.0/lib/redmine/configuration.rb:67:in `[]'
/usr/local/src/redmine-3.3.0/lib/redmine/thumbnail.rb:25:in `<module:Thumbnail>'
/usr/local/src/redmine-3.3.0/lib/redmine/thumbnail.rb:22:in `<module:Redmine>'
/usr/local/src/redmine-3.3.0/lib/redmine/thumbnail.rb:21:in `<top (required)>'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/usr/local/src/redmine-3.3.0/lib/redmine.rb:48:in `<top (required)>'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/usr/local/src/redmine-3.3.0/config/initializers/30-redmine.rb:6:in `<top (required)>'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `block in load'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
/usr/local/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:652:in `block in load_config_initializer'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:166:in `instrument'
/usr/local/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:651:in `load_config_initializer'
/usr/local/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
/usr/local/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:615:in `each'
/usr/local/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/engine.rb:615:in `block in <class:Engine>'
/usr/local/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
/usr/local/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/local/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
/usr/local/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
/usr/local/lib/ruby/2.1.0/tsort.rb:418:in `block (2 levels) in each_strongly_connected_component_from'
/usr/local/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
/usr/local/lib/ruby/2.1.0/tsort.rb:417:in `block in each_strongly_connected_component_from'
/usr/local/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:44:in `each'
/usr/local/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:44:in `tsort_each_child'
/usr/local/lib/ruby/2.1.0/tsort.rb:411:in `call'
/usr/local/lib/ruby/2.1.0/tsort.rb:411:in `each_strongly_connected_component_from'
/usr/local/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
/usr/local/lib/ruby/2.1.0/tsort.rb:345:in `each'
/usr/local/lib/ruby/2.1.0/tsort.rb:345:in `call'
/usr/local/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
/usr/local/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
/usr/local/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
/usr/local/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
/usr/local/src/redmine-3.3.0/config/environment.rb:14:in `<top (required)>'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/usr/local/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application.rb:328:in `require_environment!'
/usr/local/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application.rb:457:in `block in run_tasks_blocks'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:248:in `call'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:248:in `block in execute'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:243:in `each'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:243:in `execute'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:180:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:209:in `block in invoke_prerequisites'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:207:in `each'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:207:in `invoke_prerequisites'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:186:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:180:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/task.rb:173:in `invoke'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/application.rb:152:in `invoke_task'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/application.rb:108:in `each'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/application.rb:108:in `block in top_level'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/application.rb:117:in `run_with_threads'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/application.rb:102:in `top_level'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/application.rb:80:in `block in run'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/application.rb:178:in `standard_exception_handling'
/usr/local/lib/ruby/gems/2.1.0/gems/rake-11.2.2/lib/rake/application.rb:77:in `run'
/usr/local/bin/rake:33:in `<main>'
Tasks: TOP => db:migrate => environment
大神们,有遇到此类问题的吗?请帮忙填坑。谢谢!
高洛峰2017-04-17 15:35:55
delivery_method 如果选择smtp的话,就要给出smtp的配置。
可以考虑使用sendmail,就无需配置了,但需要安装sendmail。
如果是ubunt的话,使用sudo apt-get install sendmail
安装sendmail即可。