2016-03-30 11 views
0

Rubyバージョン1.9.3p551(RVM上)でRails 2.3.2アプリケーションを開発中です。私はこの古いアプリケーションを実行しようとしているときにrake db:migrateやrake -vなどを実行しているときに「Psych Syntax Error」を受け取っています。エラーが発生しています。私を助けてください。私が得たエラー・ログには、次のとおりです。Rails 2.3.2アプリケーションを実行中にrakeでPsych構文エラーが発生する

[email protected]:~/Desktop/practice/Application$ rake -v 
rake aborted! 
Psych::SyntaxError: (<unknown>): did not find expected node content while parsing a flow node at line 18 column 14 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:189:in `load_yml' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:176:in `load_file' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in `block in load_translations' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in `each' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:13:in `load_translations' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:85:in `init_translations' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:74:in `available_locales' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:50:in `available_locales' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:215:in `valid_locale?' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:234:in `split' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:113:in `initialize' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:87:in `new' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:87:in `create_template' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:82:in `block in templates_in_path' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:81:in `each' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:81:in `templates_in_path' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:64:in `load!' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:49:in `block in new_and_loaded' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/core_ext/object/misc.rb:39:in `returning' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_view/template.rb:48:in `new_and_loaded' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_controller/rescue.rb:41:in `<module:Rescue>' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_controller/rescue.rb:17:in `<module:ActionController>' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_controller/rescue.rb:1:in `<top (required)>' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_controller/base.rb:1406:in `block in <module:ActionController>' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_controller/base.rb:1405:in `class_eval' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_controller/base.rb:1405:in `<module:ActionController>' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/actionpack-2.3.2/lib/action_controller/base.rb:3:in `<top (required)>' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/rails-2.3.2/lib/initializer.rb:446:in `initialize_framework_caches' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/rails-2.3.2/lib/initializer.rb:144:in `process' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/rails-2.3.2/lib/initializer.rb:113:in `run' 
/home/myuser/Desktop/practice/Application/config/environment.rb:9:in `<top (required)>' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `block in require' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/rails-2.3.2/lib/tasks/misc.rake:4:in `block in <top (required)>' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/rails-2.3.2/lib/tasks/testing.rake:45:in `block (2 levels) in <top (required)>' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/rails-2.3.2/lib/tasks/testing.rake:43:in `collect' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/gems/rails-2.3.2/lib/tasks/testing.rake:43:in `block in <top (required)>' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in `eval' 
/home/myuser/.rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in `<main>' 
Tasks: TOP => test:units => db:test:prepare => db:abort_if_pending_migrations => environment 
(See full trace by running task with --trace) 

答えて

0

それはconfig/locales内に位置しているローカライゼーション・ファイルの1に構文エラーのように見えます。トレースは、ファイル名を指定しない - あなたは--traceでタスクを実行してみることができます。また、ファイルのそれぞれを解析しようとすることができます

require 'yaml' 
Dir.glob("config/locales/*.yml").each do |f| 
    begin 
    YAML.load(File.read(f)) 
    rescue Psych::SyntaxError => e 
    puts "YAML syntax error in: #{f}" 
    puts e.message 
    end 
end 

あなたのレールのルートDIRECTRYにファイルにこれを配置し、それを実行しますかruby locale_linter.rbまたはこれをコピーして通常のirbコンソールに貼り付けます。

Syntax error in: config/locales/en.yml 
(<unknown>): did not find expected key while parsing a block mapping at line 23 column 3 
=> ["config/locales/en.yml"] 

出力は、問題のあるファイルにあなたを指している必要があります

関連する問題