Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 意外关键字\u end,应为$end(SyntaxError)_Ruby On Rails_Ruby_Syntax Error - Fatal编程技术网

Ruby on rails 意外关键字\u end,应为$end(SyntaxError)

Ruby on rails 意外关键字\u end,应为$end(SyntaxError),ruby-on-rails,ruby,syntax-error,Ruby On Rails,Ruby,Syntax Error,嘿,我是RubyonRails的新手,我正在尝试从这个博客运行一个简单的程序,并且面临很多问题和错误。 无法找到解决方案 这是错误日志 /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 keywo

嘿,我是RubyonRails的新手,我正在尝试从这个博客运行一个简单的程序,并且面临很多问题和错误。 无法找到解决方案

这是错误日志

/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>'
/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active\u support/dependencies.rb:234:in'load':/home/jeevan/csv/config/routes.rb:64:语法错误,意外的关键字\u end,预期为$end(SyntaxError)
from/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active\u-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\u support/dependencies.rb:223:in`block in load\u dependenciency'
from/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active\u support/dependencies.rb:640:in'new\u constants\u in'
from/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active\u support/dependencies.rb:223:in'load\u dependenciency'
from/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active\u 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\u reloader.rb:29:in“加载路径中的块”
from/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes\u reloader.rb:29:in'each'
from/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/application/routes\u reloader.rb:29:in“加载路径”
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\u reloader.rb:7:在“初始化中的块”中
from/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active\u support/file\u update\u checker.rb:32:in'call'
from/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.1/lib/active\u support/file\u update\u checker.rb:32:in'execute\u if\u 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层)in'
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'
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:在“运行中的块初始化器”中
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`'
from/home/jeevan/csv/config.ru:4:in'require'
from/home/jeevan/csv/config.ru:4:in'block in'
from/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:51:在“实例评估”中
from/home/jeevan/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.3.5/lib/rack/builder.rb:51:在“初始化”中
from/home/jeevan/csv/config.ru:1:in'new'
from/home/jeevan/csv/config.ru:1:in`'
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'
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`'
来自脚本/rails:6:in'require'
来自脚本/rails:6:in`'
请帮我解决这个问题。

这意味着有一个语法错误,翻译成“当没有更多的东西可以完成程序时,找到了
end
关键字”。这通常是由于“开场白”数量不平衡造成的。比如说,

foo.rb:()

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


愉快的编码。

虽然这通常是一个语法错误,但我遇到了完全相同的错误消息,原因是我的RVM gemset中的gem存在未知问题。如果您没有看到语法错误,请尝试删除并重新创建您的gemset。

我也通过从routes中省略逗号得到了这个结果,而没有额外的
结尾。我发现,这是因为我的编辑器在mac编辑器中“巧妙地”更改了引号。

某个地方将丢失一个
结尾
,并且在第64行检测到它。@mliebelt错误;-)“expecting$end”不是ruby end关键字,它是一个bison解析器错误。
if true
  puts "hello world"
  end   # the indent
end     # is a lie