I get a syntax error when i try to run 'rake db:setup'. I didn't face any problems when i ran 'bundle install' I'm trying to get the Typo app (from the saasbook) running. I'm using Ruby 1.9.3 and 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 "$0" "$@"
^
from /home/ubuntu/.rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:24:in `<main>'
This is my 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
How do i resolve this?
There is a problem with rake. Reinstall rake using the same version specified in the Gemfile can solve the problem. gem install rake -v 0.9.2
Ruby(1.9.3) on Rails(3.0.10) is not compatible with Postgresql 10. You have to use Postgresql 9 or a lower version with Rails 3. I was running the app on AWS Cloud9 - Ubuntu 18. By default sudo apt-get install postgresql
will install postgresql 10. So using an older version might work.
PS - Switching to AWS Linux from Ubuntu and running the app worked.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.