2
我升級到Mountain Lion,並且我的穩定的紅寶石環境讓我瘋狂。升級後,Rails服務器無法運行Mountain Lion
我現在的問題是,我的Rails服務器退出對我道:
Ayman$ cd Sites/simple_cms
Ayman$ rails server
=> Booting WEBrick
=> Rails 3.2.6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Library/Ruby/Gems/1.8/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load': /Users/Ayman/Sites/simple_cms/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end (SyntaxError)
...sion_store :cookie_store, key: '_simple_cms_session'
^
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/engine.rb:588
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/engine.rb:587:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/engine.rb:587
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `run'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:55:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `each'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/application.rb:136:in `initialize!'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `send'
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/Ayman/Sites/simple_cms/config/environment.rb:5
from /Users/Ayman/Sites/simple_cms/config.ru:4:in `require'
from /Users/Ayman/Sites/simple_cms/config.ru:4
from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from /Users/Ayman/Sites/simple_cms/config.ru:1:in `new'
from /Users/Ayman/Sites/simple_cms/config.ru:1
所以我跑了捆綁安裝的,現在我不知道是什麼問題我的寶石是最新的:
Ayman$ gem list
*** LOCAL GEMS ***
actionmailer (3.2.8, 3.2.6)
actionpack (3.2.8, 3.2.6)
activemodel (3.2.8, 3.2.6)
activerecord (3.2.8, 3.2.6)
activeresource (3.2.8, 3.2.6)
activesupport (3.2.8, 3.2.6)
arel (3.0.2)
builder (3.0.0)
bundler (1.1.5)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
erubis (2.7.0)
execjs (1.4.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.4)
jquery-rails (2.0.2)
json (1.7.5, 1.7.3)
mail (2.4.4)
mime-types (1.19)
multi_json (1.3.6)
mysql2 (0.3.11)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.8, 3.2.6)
railties (3.2.8, 3.2.6)
rake (0.9.2.2)
rdoc (3.12)
rubygems-update (1.8.24)
sass (3.1.19)
sass-rails (3.2.5)
sprockets (2.1.3)
thor (0.15.3)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)
uglifier (1.2.5)
有什麼線索可以導致這個問題?謝謝!
你能張貼問題的代碼行(S),你可以從輸出日誌中看到答案:'<...> /active_support/dependencies.rb:245:in '負荷': <...> /config/initializers/session_store.rb:3:語法錯誤,意外的':',期待$ end(SyntaxError)''。由此看來,錯誤出現在您的代碼中,而不是您的升級。 –
我的猜測是你的默認ruby是ruby 1.8,而你的代碼是爲ruby 1.9編寫的。 'ruby -v'告訴你什麼? – Casper
@Casper看起來你是對的。我運行1.8.7,這很奇怪,因爲我之前運行的是1.9.3。現在,如果只有RVM正在工作...... 一旦修復就立即繞圈! – aalab002