简体   繁体   中英

Difficulties with Ruby version for Rails and activesupport-3.2.12

I have a rails application which works built on my test environment.

ruby -v  => 1.9.3p194    
rails -v => 3.2.12    
gem -v   => 1.8.23

On the server I wish to deploy to, the outputs are the following:

ruby -v  => 1.9.3p0
rails -v => 3.2.12
gem -v   => 1.8.15

I've started with a fresh installation of the server but I cannot get the server version of ruby and gem to match.

Additionally when I run rails s on the server (just to test) this is the failed output:

rails s
=> Booting WEBrick
=> Rails 3.2.12 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/var/lib/gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in `load': /var/www/New/confed ':', expecting kEND (SyntaxError)
  match '/about',   to: 'static_pages#about'
                       ^
/var/www/New/config/routes.rb:6: syntax error, unexpected ':', expecting kEND
  match '/cv',          to: 'static_pages#cv'
                           ^
        from /var/lib/gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in `load'
        from /var/lib/gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
        from /var/lib/gems/1.8/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in `load'
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/application/routes_reloader.rb:40:in `load_paths'
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/application/routes_reloader.rb:40:in `each'
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/application/routes_reloader.rb:40:in `load_paths'
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/application/routes_reloader.rb:16:in `reload!'
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/application/routes_reloader.rb:26:in `updater'
        from /var/lib/gems/1.8/gems/activesupport-3.2.12/lib/active_support/file_update_checker.rb:78:in `call'
        from /var/lib/gems/1.8/gems/activesupport-3.2.12/lib/active_support/file_update_checker.rb:78:in `execute'
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/application/routes_reloader.rb:27:in `updater'
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/application/finisher.rb:66
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `run_initializers'
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `send'
        from /var/lib/gems/1.8/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
        from /var/www/New/config/environment.rb:5
        from /var/www/New/config.ru:3:in `require'
        from /var/www/New/config.ru:3
        from /var/lib/gems/1.8/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
        from /var/lib/gems/1.8/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
        from /var/www/New/config.ru:0:in `new'
        from /var/www/New/config.ru:0

I've looked on my test system and I don't have /var/lib/gems/1.8 I only have /var/lib/gems/1.9.1

From your stack trace, it actually looks like you're running against Ruby 1.8, which doesn't support the simplified hash syntax symbol: value whereas 1.8 only had :symbol => value .

You can use rvm or rbenv to manage multiple ruby versions. rbenv imo is the better of the two when working with Rails.


Answering Ryan's question of why I think rbenv > rvm is based on personal feelings. I've found rbenv easy to work with, easy to understand and conceptualize how it was working, and I haven't run into a scenario where it has failed me. Additionally the source code is quite readable, which made my one foray for configuration easy to do.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM