使用 ruby 1.9.3 时出现语法错误 运行 'rake db:setup'

Syntax error when i run 'rake db:setup' while using ruby 1.9.3

当我尝试 运行 'rake db:setup' 时出现语法错误。当我 运行 'bundle install' 尝试获取 Typo 应用程序(来自 saasbook)运行ning 时,我没有遇到任何问题。我正在使用 Ruby 1.9.3 和 rails '3.0.10'

ubuntu:~/environment/typo (master) $  rake db:setup
/home/ubuntu/.rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:24:in `eval': /home/ubuntu/.rvm/rubies/ruby-1.9.3-p551/bin/rake:4: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' (SyntaxError)
exec "$bindir/ruby" -x "[=13=]" "$@"
                        ^
        from /home/ubuntu/.rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:24:in `<main>'

这是我的 Gemfile

env = ENV["RAILS_ENV"] || 'development'
dbfile = File.expand_path("../config/database.yml", __FILE__)



source 'https://rubygems.org'
ruby "1.9.3"

gem 'thin'
gem 'rails', '~> 3.0.10'
gem 'require_relative'
gem 'htmlentities'
gem 'json'
gem 'bluecloth', '~> 2.1'
gem 'coderay', '~> 0.9'
gem 'kaminari'
gem 'RedCloth', '~> 4.2.8'
gem 'addressable', '~> 2.1', :require => 'addressable/uri'
gem 'mini_magick', '~> 1.3.3', :require => 'mini_magick'
gem 'uuidtools', '~> 2.1.1'
gem 'flickraw-cached'
gem 'rubypants', '~> 0.2.0'
gem 'rake', '~> 0.9.2'
gem 'acts_as_list'
gem 'acts_as_tree_rails3'
gem 'recaptcha'
gem 'pg'

group :development, :test do
  gem 'ruby-debug19'
  gem 'factory_girl', '~> 2.2'
  gem 'webrat'
  gem 'rspec-rails', '~> 2.0'
  gem 'simplecov', :require => false
  # gem 'sqlite3'
  gem 'cucumber'
  gem 'cucumber-rails', :require => false
  gem 'cucumber-rails-training-wheels'
  gem 'database_cleaner'
  gem 'capybara'
end

我该如何解决?

rake 有问题。使用 Gemfile 中指定的相同版本重新安装 rake 可以解决问题。 gem install rake -v 0.9.2

Ruby(1.9.3) on Rails(3.0.10) 与 Postgresql 10 不兼容。您必须使用 Postgresql 9 或更低版本 Rails 3 . 我是 运行 AWS Cloud9 上的应用程序 - Ubuntu 18。默认情况下 sudo apt-get install postgresql 将安装 postgresql 10。因此使用旧版本可能会起作用。

PS - 从 Ubuntu 切换到 AWS Linux 并且 运行 应用程序运行正常。