我试图使用capistrano将rails 3.2.11应用程序部署到bluehost共享主机上。我一直得到这个错误
[myapp.com] executing command
*** [err :: myapp.com] rake aborted!
*** [err :: myapp.com] (<unknown>): did not find expected node content while parsing a block node at line 18 column 13
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application/configuration.rb:115:in `database_configuration'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/railtie.rb:78:in `block (2 levels) in <class:Railtie>'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:26:in `block in on_load'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:25:in `each'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.11/lib/active_record/railtie.rb:74:in `block in <class:Railtie>'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/releases/20130115050636/config/environment.rb:5:in `<top (required)>'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:103:in `require_environment!'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/sprockets/assets.rake:93:in `block (2 levels) in <top (required)>'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/sprockets/assets.rake:23:in `invoke_or_reboot_rake_task'
*** [err :: myapp.com] /home2/myappc/rails_apps/myapp/shared/bundle/ruby/1.9.1/gems/actionpack-3.2.11/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
错误显示(<unknown>): did not find expected node content while parsing a block node at line 18 column 13
,但我不知道它实际上指的是哪个文件。
这是上面日志文件第4行中的database_configuration
# Loads and returns the contents of the #database_configuration_file. The
# contents of the file are processed via ERB before being sent through
# YAML::load.
def database_configuration
require 'erb'
YAML::load(ERB.new(IO.read(paths["config/database"].first)).result)
end
我环顾四周,这可能是YAML解析错误。所以我试着在irb中使用这个,看看是否有任何.yml
文件引起了麻烦
YAML.load_file("filename.yml")
但结果都很好。
如果需要的话,这是我的Gemfile
gem 'rails', '3.2.11'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'devise'
gem 'friendly_id', "~> 4.0.9"#, :git => "git://github.com/norman/friendly_id.git"
gem 'simple_form'
gem 'json'
gem 'cancan'
gem 'rqrcode-rails3' #imageqrcodes
gem 'mini_magick'
gem "breadcrumbs_on_rails"
group :production do
gem 'pg'
# gem 'thin' # Server used in production
end
group :development, :test do
gem 'mysql2'
gem 'capistrano'
gem 'rvm-capistrano'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
gem 'twitter-bootstrap-rails'
gem 'execjs', '1.4.0'
gem 'therubyracer', :platforms => :ruby
end
gem 'jquery-rails'
问题是,在我的database.yml
文件。我的密码以一个符号开头。我找不到摆脱它的方法,所以我改变了它,现在它像魔法一样有效。