未定义的方法`require'对于Rack :: Builder

时间:2016-02-25 18:11:38

标签: ruby sinatra rack

当我尝试通过Ti.Geolocation.locationServiceEnabled命令启动我的Sinatra应用程序时,我收到此错误:

rackup

但是当我使用/home/matteog/Scrivania/ruby_ws/config.ru:1:in `block in <main>': undefined method `require' for #<Rack::Builder:0x000000027d4e50> (NoMethodError) from /home/matteog/.rvm/gems/ruby-2.1.2/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval' from /home/matteog/.rvm/gems/ruby-2.1.2/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize' from /home/matteog/Scrivania/ruby_ws/config.ru:in `new' from /home/matteog/Scrivania/ruby_ws/config.ru:in `<main>' from /home/matteog/.rvm/gems/ruby-2.1.2/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval' from /home/matteog/.rvm/gems/ruby-2.1.2/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string' from /home/matteog/.rvm/gems/ruby-2.1.2/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file' from /home/matteog/.rvm/gems/ruby-2.1.2/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config' from /home/matteog/.rvm/gems/ruby-2.1.2/gems/rack-1.6.4/lib/rack/server.rb:208:in `app' from /home/matteog/.rvm/gems/ruby-2.1.2/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app' from /home/matteog/.rvm/gems/ruby-2.1.2/gems/rack-1.6.4/lib/rack/server.rb:272:in `start' from /home/matteog/.rvm/gems/ruby-2.1.2/gems/rack-1.6.4/lib/rack/server.rb:147:in `start' from /home/matteog/.rvm/gems/ruby-2.1.2/gems/rack-1.6.4/bin/rackup:4:in `<top (required)>' from /home/matteog/.rvm/gems/ruby-2.1.2/bin/rackup:23:in `load' from /home/matteog/.rvm/gems/ruby-2.1.2/bin/rackup:23:in `<main>' from /home/matteog/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval' from /home/matteog/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>' 时,我没有任何问题。我的ruby helloworld.rb非常简单:

config.ru

此外,我在require 'helloworld' run Sinatra::Application 之前成功执行bundle install,使用此Gemfile(省略输出):

rackup

1 个答案:

答案 0 :(得分:1)

解决chat - 对于遇到相同问题的人的摘要:

如果我将其粘贴到VIM中,我会得到:

undefined method `<feff>require' for

Unicode 0xFEFF是BOM character,可能由编辑器插入。