Bundle install throwing syntax error when setting up Rails

apache-2.2ruby-on-rails

I'm trying to deploy a rails app to Passenger.

When running bundle:

[ps93785]$ /usr/lib/ruby/gems/1.8/bin//bundle install

I get this:

Gemfile syntax error:
/home/djwyatt/supplies.mighty-wash.com/public/Gemfile:33: syntax error,
unexpected ':', expecting kEND
  gem 'sdoc', require: false

edit 1
This are lines 31-34 if the gem file:

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

This worked totally fine in my local environment, any idea why it would be giving me problems on my VPS?

Edit 2
(I was developing on Ruby 2.0, my VPS is on 1.8)

Here is the problem I am running into when trying to upgrade:

[ps93785]$ rvm upgrade 2.0
The source ruby was not a valid ruby string.

1.9.3 also does not work

Edit 3
(this worked)
rvm use 2.0
then bundle install worked fantastic. Now there is a new issue – dump below:

[ps93785]$ rake about
rake aborted!
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.
/home/djwyatt/.rvm/gems/ruby-2.0.0-p247/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect'
/home/djwyatt/.rvm/gems/ruby-2.0.0-p247/gems/execjs-1.4.0/lib/execjs.rb:5:in `<module:ExecJS>'
/home/djwyatt/.rvm/gems/ruby-2.0.0-p247/gems/execjs-1.4.0/lib/execjs.rb:4:in `<top (required)>'
/home/djwyatt/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.1.2/lib/uglifier.rb:3:in `require'
/home/djwyatt/.rvm/gems/ruby-2.0.0-p247/gems/uglifier-2.1.2/lib/uglifier.rb:3:in `<top (required)>'
/home/djwyatt/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
/home/djwyatt/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
/home/djwyatt/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
/home/djwyatt/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
/home/djwyatt/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
/home/djwyatt/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
/home/djwyatt/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
/home/djwyatt/supplies.mighty-wash.com/public/config/application.rb:7:in `<top (required)>'
/home/djwyatt/supplies.mighty-wash.com/public/Rakefile:4:in `require'
/home/djwyatt/supplies.mighty-wash.com/public/Rakefile:4:in `<top (required)>'
/home/djwyatt/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
/home/djwyatt/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
(See full trace by running task with --trace)

Best Answer

First, you need to use ruby 1.8 syntax in your Gemfile:

group :doc do
  gem 'sdoc', :require => false
end

Second, I'm not sure if recent versions of Passenger will support Ruby 1.8. Even if it does, you should upgrade to at least ruby-1.9.3.