意外的keyword_end,期待$end (SyntaxError) [英] unexpected keyword_end, expecting $end (SyntaxError)

查看:63
本文介绍了意外的keyword_end,期待$end (SyntaxError)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我是 ruby​​ on rails 的新手,我正在尝试从这个博客运行一个简单的程序,但遇到了很多问题错误.http://goodbadtech.com/2009/05/13/ruby-on-rails-import-csv-data-into-database/无法找出解决方案.

这是错误日志.

/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load':/home/jeevan/csv/config/routes.rb:64: 语法错误,意外的keyword_end,期待$end (SyntaxError)来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `block in load'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `block in load_dependency'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in`new_constants_in'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in`load_dependency'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `block in load_paths'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `each'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `load_paths'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:13:in `reload!'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:7:in `block in initialize'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `call'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/finisher.rb:63:in `block (2 levels) in <module:整理器>'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/finisher.rb:64:in `call'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/finisher.rb:64:in `block in '来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `instance_exec'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `run'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:55:in `block in run_initializers'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `each'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `run_initializers'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application.rb:96:in `initialize!'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in `method_missing'来自/home/jeevan/csv/config/environment.rb:5:in `'来自/home/jeevan/csv/config.ru:4:in `require'来自/home/jeevan/csv/config.ru:4:in ‘block in <main>’来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:51:in `instance_eval'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:51:in `initialize'来自/home/jeevan/csv/config.ru:1:in `new'来自/home/jeevan/csv/config.ru:1:in ‘<main>’来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:40:in `eval'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:40:in `parse_file'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/server.rb:200:in `app'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands/server.rb:46:in `app'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/server.rb:301:in `wrapped_app'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/server.rb:252:in `start'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands/server.rb:70:in `start'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:54:in `block in '来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:49:in `tap'来自/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:49:in `'来自 script/rails:6:in `require'来自 script/rails:6:in `<main>'

请帮我解决这个问题

解决方案

这意味着存在一个语法错误,翻译为end 关键字被发现时仅此而已预计完成该计划".这通常是由于开场白"的数量不平衡.例如,

foo.rb: (演示)

如果为真把你好世界"end # 缩进end # 是谎言

<块引用>

第 4 行:语法错误,意外的 kEND [keyword_end],期待 $end

快乐编码.

hey I am newbie to ruby on rails and I am trying run a simple program from this blog and facing lot of problems error. http://goodbadtech.com/2009/05/13/ruby-on-rails-import-csv-data-into-database/ Could not able to figure out the solution.

Here is the error log.

/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load': /home/jeevan/csv/config/routes.rb:64: syntax error, unexpected keyword_end, expecting $end (SyntaxError)
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `block in load'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `block in load_dependency'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:640:in `new_constants_in'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:223:in `load_dependency'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:234:in `load'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `block in load_paths'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `each'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:29:in `load_paths'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:13:in `reload!'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes_reloader.rb:7:in `block in initialize'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `call'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active_support/file_update_checker.rb:32:in `execute_if_updated'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/finisher.rb:63:in `block (2 levels) in <module:Finisher>'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/finisher.rb:64:in `call'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/finisher.rb:64:in `block in <module:Finisher>'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `instance_exec'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:30:in `run'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `each'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/initializable.rb:54:in `run_initializers'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application.rb:96:in `initialize!'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
        from /home/jeevan/csv/config/environment.rb:5:in `<top (required)>'
        from /home/jeevan/csv/config.ru:4:in `require'
        from /home/jeevan/csv/config.ru:4:in `block in <main>'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:51:in `instance_eval'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:51:in `initialize'
        from /home/jeevan/csv/config.ru:1:in `new'
        from /home/jeevan/csv/config.ru:1:in `<main>'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:40:in `eval'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:40:in `parse_file'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/server.rb:200:in `app'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands/server.rb:46:in `app'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/server.rb:301:in `wrapped_app'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/server.rb:252:in `start'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands/server.rb:70:in `start'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:54:in `block in <top (required)>'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:49:in `tap'
        from /home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:49:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

Please help me out in this

解决方案

This means there is a syntax error and translates to "the end keyword was found when nothing more was expected to complete the program". This is usually due to an unbalanced number of "openers". For instance,

foo.rb: (demonstration)

if true
  puts "hello world"
  end   # the indent
end     # is a lie

Line 4: syntax error, unexpected kEND [keyword_end], expecting $end

Happy coding.

这篇关于意外的keyword_end,期待$end (SyntaxError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆