[英]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. 您可以使用rvm或rbenv来管理多个ruby版本。
rbenv
imo is the better of the two when working with Rails. 在使用Rails时,
rbenv
imo是两者中最好的。
rbenv > rvm
is based on personal feelings.
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.