简体   繁体   中英

error starting rails server 4

I am new to ruby on rails, I am getting following error after starting rails server 'rails server'

> Booting WEBrick
=> Rails 4.0.0 application starting in development on ://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:233:in `default_controller_and_action': missing :action (ArgumentError)
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:116:in `normalize_options!'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:64:in `initialize'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `new'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1438:in `add_route'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1417:in `decomposed_match'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1398:in `block in match'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `each'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1389:in `match'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:330:in `root'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:1459:in `root'
    from /home/mahipal/rails_projects/sample_app/config/routes.rb:3:in `block in <top (required)>'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `instance_exec'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `eval_block'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:294:in `draw'
    from /home/mahipal/rails_projects/sample_app/config/routes.rb:1:in `<top (required)>'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `each'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `load_paths'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:16:in `reload!'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:26:in `block in updater'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `call'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `execute'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:27:in `updater'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/mahipal/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/tsort.rb:150:in `block in tsort_each'
    from /home/mahipal/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
    from /home/mahipal/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/tsort.rb:219:in `each_strongly_connected_component_from'
    from /home/mahipal/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/tsort.rb:182:in `block in each_strongly_connected_component'
    from /home/mahipal/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/tsort.rb:180:in `each'
    from /home/mahipal/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/tsort.rb:180:in `each_strongly_connected_component'
    from /home/mahipal/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/tsort.rb:148:in `tsort_each'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /home/mahipal/rails_projects/sample_app/config/environment.rb:5:in `<top (required)>'
    from /home/mahipal/rails_projects/sample_app/config.ru:3:in `require'
    from /home/mahipal/rails_projects/sample_app/config.ru:3:in `block in <main>'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
    from /home/mahipal/rails_projects/sample_app/config.ru:in `new'
    from /home/mahipal/rails_projects/sample_app/config.ru:in `<main>'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/commands/server.rb:48:in `app'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/commands/server.rb:75:in `start'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/commands.rb:78:in `block in <top (required)>'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
    from /home/mahipal/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

Take care with the spaces in the Routes.

get '/way' , to: 'controller#action' #one space Ok

get '/way' , to:  'controller#action' # two spaces Erro 

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