When i try to start my Sinatra app via rackup
command i get this error:
/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>'
But i have no problems when i use ruby helloworld.rb
. My config.ru
is very simple:
require 'helloworld'
run Sinatra::Application
Furthermore i successfully executed bundle install
before rackup
, with this Gemfile (output omitted):
source 'https://rubygems.org'
ruby '2.1.2'
gem 'sinatra', '>= 1.4.5', '~> 1.4'
gem 'sinatra-contrib', '>= 1.4.2', '~> 1.4'
gem 'dm-core', '>= 1.2.0', '~> 1.2'
gem 'dm-sqlite-adapter', '>= 1.2.0', '~> 1.2'
gem 'dm-validations', '>= 1.2.0', '~> 1.2'
gem 'dm-timestamps', '>= 1.2.0', '~> 1.2'
gem 'dm-migrations', '>= 1.2.0', '~> 1.2'
group :development, :test do
gem 'timecop'
gem 'simplecov'
gem 'minitest'
end
Solved in chat - summary for anyone having the same issue:
If I paste it into VIM, I get:
undefined method `<feff>require' for
Unicode 0xFEFF is the BOM character, probably inserted by the editor.