2013-07-01 131 views
0

我有一個嘗試啓動我的Rails項目的主要問題。我正在使用rails 4.0.0項目並嘗試在Rails 3.2.6系統上運行它。我的工作環境使用Rails 3.2.6環境,我的系統在家裏工作(Mac mini)使用rails 4.自那時起我開始使用我的Linux筆記本電腦,它具有Rails 3.2.6,就像我的僱主使用的一樣。無法在3.2.6系統上啓動Rails服務器

這是我的錯誤跟蹤:

[email protected]:~/RoR_projects/mock_devices2$ 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 
/home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/actionpack-3.2.6/lib/action_dispatch/routing/mapper.rb:260:in `merge': can't convert String into Hash (TypeError) 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/actionpack-3.2.6/lib/action_dispatch/routing/mapper.rb:260:in `root' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/actionpack-3.2.6/lib/action_dispatch/routing/mapper.rb:1317:in `root' 
     from /home/ironmantis7x/RoR_projects/mock_devices2/config/routes.rb:10:in `block in <top (required)>' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:282:in `eval_block' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:260:in `draw' 
     from /home/ironmantis7x/RoR_projects/mock_devices2/config/routes.rb:1:in `<top (required)>' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `block in load' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:40:in `block in load_paths' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:40:in `each' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:40:in `load_paths' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:16:in `reload!' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:26:in `block in updater' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/activesupport-3.2.6/lib/active_support/file_update_checker.rb:78:in `call' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/activesupport-3.2.6/lib/active_support/file_update_checker.rb:78:in `execute' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:27:in `updater' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `run' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/initializable.rb:55:in `block in run_initializers' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `each' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/application.rb:136:in `initialize!' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing' 
     from /home/ironmantis7x/RoR_projects/mock_devices2/config/environment.rb:5:in `<top (required)>' 
     from /home/ironmantis7x/RoR_projects/mock_devices2/config.ru:4:in `require' 
     from /home/ironmantis7x/RoR_projects/mock_devices2/config.ru:4:in `block in <main>' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize' 
     from /home/ironmantis7x/RoR_projects/mock_devices2/config.ru:1:in `new' 
     from /home/ironmantis7x/RoR_projects/mock_devices2/config.ru:1:in `<main>' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/rack-1.4.1/lib/rack/server.rb:200:in `app' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/commands/server.rb:46:in `app' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/rack-1.4.1/lib/rack/server.rb:252:in `start' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/commands/server.rb:70:in `start' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/commands.rb:55:in `block in <top (required)>' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap' 
     from /home/ironmantis7x/.rvm/gems/[email protected]_testbed1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `<top (required)>' 
     from script/rails:6:in `require' 
     from script/rails:6:in `<main>' 
[email protected]:~/RoR_projects/mock_devices2$ 

這裏是我的environment.rb文件中:

# Load the Rails application. 
require File.expand_path('../application', __FILE__) 

# Initialize the Rails application. 
MockDevices2::Application.initialize! 

這裏是我的boot.rb文件:

# Set up gems listed in the Gemfile. 
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 

require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 
require 'thread' 

我的寶石清單如下:

actionmailer (3.2.6) 
actionpack (3.2.6) 
activemodel (3.2.6) 
activerecord (3.2.6) 
activeresource (3.2.6) 
activesupport (3.2.6) 
arel (3.0.2) 
builder (3.0.4) 
bundler (1.3.5) 
bundler-unload (1.0.1) 
coffee-rails (3.2.2) 
coffee-script (2.2.0) 
coffee-script-source (1.6.2) 
erubis (2.7.0) 
execjs (1.4.0) 
hike (1.2.3) 
i18n (0.6.4) 
jbuilder (1.4.2) 
journey (1.0.4) 
jquery-rails (3.0.1) 
json (1.8.0) 
mail (2.4.4) 
mime-types (1.23) 
mini_portile (0.5.0) 
multi_json (1.7.7) 
nokogiri (1.6.0) 
polyglot (0.3.3) 
rack (1.4.1) 
rack-cache (1.2) 
rack-ssl (1.3.3) 
rack-test (0.6.2) 
rails (3.2.6) 
railties (3.2.6) 
rake (10.1.0) 
rdoc (3.12.2) 
rubygems-bundler (1.2.0) 
rvm (1.11.3.8) 
sass (3.2.9) 
sass-rails (3.2.6) 
sdoc (0.3.20) 
sprockets (2.1.3) 
sqlite3 (1.3.7) 
thor (0.18.1) 
tilt (1.4.1) 
treetop (1.4.14) 
turbolinks (1.2.0) 
tzinfo (0.3.37) 
uglifier (2.1.1) 
+3

「我正在接受一個rails 4.0.0項目,並試圖在rails 3.2.6系統上運行它。」 - wat?這是一個錯字嗎? –

+1

如果你參加4.0.0 rails項目,你應該升級系統上的rails來匹配項目,使用RVM或者全新安裝 –

+0

我不能將我的作業系統升級到rails 4.0.0。他們有sai dthat他們現在不會這樣做。所以我必須使用rails 3.2.6。不,這不是一個錯字。我在rails 4.0.0系統上開發了一個項目(這是一個錯誤),我需要嘗試在rails 3.2.6系統上運行相同的項目。我需要幫助找出需要解決的問題以及如何解決問題以便運行。我對ruby/rails非常陌生。請理解... – ironmantis7x

回答

4

你可以發佈你的routes.rb嗎?好像問題出在

from /home/ironmantis7x/RoR_projects/mock_devices2/config/routes.rb:10:in `block in <top (required)>' 

這發生在我身上,問題是,我使用的

root 'welcome#index' 

代替

root to: 'welcome#index' 

和軌道3不一樣,

+0

這對我來說已經修好了,非常感謝。 – Will

+0

@halfer:您決定通過修正拼寫錯誤和語法錯誤來提供幫助,而不是提供技術洞察力和方法來實際修復代碼併爲實際問題提供解決方案。作爲有抱負的開發人員和開發人員,在我們遇到像你這樣的人時,這對我們來說是非常糟糕的。除了修復英語語法錯誤之外,請找到更合理的技術方法來提高您在這裏的聲譽。你下次能真正做出代碼貢獻嗎? – ironmantis7x

+0

@Ninjarabbi:你的郵箱解決了我的問題。謝謝。 – ironmantis7x