尝试运行时rails server
或rails console
出现以下错误:
$ bundle exec rails server
/path/to/project/vendor/bundle/ruby/1.9.1/gems/psych-2.0.5/lib/psych.rb:1:in `require': SyntaxError is already defined (NameError)
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/psych-2.0.5/lib/psych.rb:1:in `<top (required)>'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.14/lib/active_support/ordered_hash.rb:2:in `require'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.14/lib/active_support/ordered_hash.rb:2:in `<top (required)>'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.14/lib/active_support/ordered_options.rb:1:in `require'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.14/lib/active_support/ordered_options.rb:1:in `<top (required)>'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/configuration.rb:2:in `require'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/configuration.rb:2:in `<top (required)>'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/railtie.rb:2:in `require'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/railtie.rb:2:in `<top (required)>'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/engine.rb:1:in `require'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/engine.rb:1:in `<top (required)>'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/plugin.rb:1:in `require'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/plugin.rb:1:in `<top (required)>'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/application.rb:3:in `require'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/application.rb:3:in `<top (required)>'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails.rb:10:in `require'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails.rb:10:in `<top (required)>'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/all.rb:1:in `require'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/all.rb:1:in `<top (required)>'
from /path/to/project/config/application.rb:3:in `require'
from /path/to/project/config/application.rb:3:in `<top (required)>'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/commands.rb:53:in `require'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/commands.rb:53:in `block in <top (required)>'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/commands.rb:50:in `tap'
from /path/to/project/vendor/bundle/ruby/1.9.1/gems/railties-3.2.14/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
第一行/path/to/project/vendor/bundle/ruby/1.9.1/gems/psych-2.0.5/lib/psych.rb
是require 'psych.so'
. 我使用 ruby 1.9.3,rails 3.2.14,psych 版本 2.0.5 安装在Gemfile.lock
.