简体   繁体   English

Ruby版本的Rails和activesupport-3.2.12的困难

[英]Difficulties with Ruby version for Rails and activesupport-3.2.12

I have a rails application which works built on my test environment. 我有一个rails应用程序,它可以在我的测试环境中构建。

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. 我已经开始全新安装服务器,但我无法获得ruby和gem的服务器版本。

Additionally when I run rails s on the server (just to test) this is the failed output: 另外,当我在服务器上运行rails时(只是为了测试),这是失败的输出:

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 我查看了我的测试系统而没有/var/lib/gems/1.8我只有/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 . 从堆栈跟踪中,它实际上看起来像是在运行Ruby 1.8,它不支持简化的哈希语法symbol: value而1.8只有:symbol => value

You can use rvm or rbenv to manage multiple ruby versions. 您可以使用rvmrbenv来管理多个ruby版本。 rbenv imo is the better of the two when working with Rails. 在使用Rails时, rbenv imo是两者中最好的。


Answering Ryan's question of why I think rbenv > rvm is based on personal feelings. 回答Ryan关于为什么我认为rbenv > rvm基于个人感受的问题。 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. 我发现rbenv易于使用,易于理解并概念化它是如何工作的,而且我没有遇到过它让我失望的情况。 Additionally the source code is quite readable, which made my one foray for configuration easy to do. 此外,源代码非常易读,这让我很容易进行配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Windows activesupport中安装Rails需要Ruby版本> = 2.2.2 - Intalling Rails in windows activesupport requires Ruby version >= 2.2.2 Rails 安装失败:activesupport 需要 Ruby 版本 >= 2.2.2 - Rails install fails: activesupport requires Ruby version >= 2.2.2 ActiveSupport Ruby on Rails - ActiveSupport Ruby on Rails AWS Rails安装失败:activesupport需要Ruby版本> = 2.2.2 - AWS Rails install fails: activesupport requires Ruby version >= 2.2.2 安装libCurl-ruby 1.9.3 .. rails 3.2.12 .. Windows - Installing libCurl - ruby 1.9.3 .. rails 3.2.12 .. Windows Ruby on Rails-ActiveSupport:数组扩展 - Ruby on Rails - ActiveSupport: Array Extensions 安装 Rails 时出错:activesupport 需要 Ruby 版本 >= 2.7.0。 (寻找解决方案) - ERROR Installing Rails: activesupport requires Ruby version >= 2.7.0. (Looking for solution) 如何将Twitter Bootstrap与Ruby on Rails 3.2.12结合使用? - How do I use Twitter Bootstrap with Ruby on Rails 3.2.12? ActiveSupport在Ubuntu上需要Ruby版本> = 1.8.7 - ActiveSupport requires Ruby version >= 1.8.7 on Ubuntu 错误:安装friendly_id时出错:activesupport需要Ruby版本> = 1.9.3。 使用Rails2.3.3和Ruby 1.8.7 - ERROR: Error installing friendly_id: activesupport requires Ruby version >= 1.9.3. with Rails2.3.3 and Ruby 1.8.7
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM