0

我正在尝试使用 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,但我不知道它实际指的是哪个文件。

这是database_configuration上面日志文件中的第 4 行

# 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'
4

1 回答 1

0

问题是在我的database.yml文件中。我的密码以符号开头。我找不到逃避它的方法,所以我改变了它,它现在就像一个魅力。

于 2013-01-15T20:04:59.540 回答