简体   繁体   中英

Can't start Rails server on 3.2.6 system

I am having a major issue trying to start my Rails project. I am taking a rails 4.0.0 project and trying to run it on a Rails 3.2.6 system. My work environment uses a Rails 3.2.6 environment and my system at home where I was working from home (a mac mini) uses rails 4. I have since started using my Linux laptop which has Rails 3.2.6 like my employer uses.

Here is my error trace:

ironmantis7x@ironscribe5:~/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/ruby-1.9.3-p448@rails_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/ruby-1.9.3-p448@rails_testbed1/gems/actionpack-3.2.6/lib/action_dispatch/routing/mapper.rb:260:in `root'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_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/ruby-1.9.3-p448@rails_testbed1/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/actionpack-3.2.6/lib/action_dispatch/routing/route_set.rb:282:in `eval_block'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_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/ruby-1.9.3-p448@rails_testbed1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `block in load'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:40:in `each'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:40:in `load_paths'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:16:in `reload!'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:26:in `block in updater'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/activesupport-3.2.6/lib/active_support/file_update_checker.rb:78:in `call'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/activesupport-3.2.6/lib/active_support/file_update_checker.rb:78:in `execute'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:27:in `updater'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `run'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `each'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/application.rb:136:in `initialize!'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_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/ruby-1.9.3-p448@rails_testbed1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_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/ruby-1.9.3-p448@rails_testbed1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/commands/server.rb:46:in `app'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/commands/server.rb:70:in `start'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/commands.rb:55:in `block in <top (required)>'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_testbed1/gems/railties-3.2.6/lib/rails/commands.rb:50:in `tap'
        from /home/ironmantis7x/.rvm/gems/ruby-1.9.3-p448@rails_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>'
ironmantis7x@ironscribe5:~/RoR_projects/mock_devices2$ 

Here is my environment.rb file:

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

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

And here is my boot.rb file:

# 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'

my gem list is as follows:

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)

Can you post your routes.rb? Seems like the problem is at

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

This happened to me and the problem was that I used

root 'welcome#index'

instead of

root to: 'welcome#index'

and rails 3 doesn't like that

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