I'm trying to set up and run the Extreme Startup coding dojo on my Windows machine.
When I try to access the front page on http://localhost:3000, I get this error:
application error
Errno::ENOENT at /
No such file or directory @ rb_sysopen - c:/Users/mark/Desktop/extreme_startup/lib/extreme_startup/views/leaderboard.haml
file: template.rb location: initialize line: 210
BACKTRACE
(expand)
JUMP TO: GET POST COOKIES ENV
c:/Users/mark/Desktop/extreme_startup/lib/extreme_startup/web_server.rb in block in <class:WebServer>
set :players, Hash.new
set :players_threads, Hash.new
set :scoreboard, Scoreboard.new(ENV['LENIENT'])
set :question_factory, ENV['WARMUP'] ? WarmupQuestionFactory.new : QuestionFactory.new
set :game_state, GameState.new
get '/' do
haml :leaderboard, :locals => {
:leaderboard => LeaderBoard.new(scoreboard, players, game_state),
:players => players }
end
get '/scores' do
LeaderBoard.new(scoreboard, players, game_state).to_json
end
GET
No GET data.
POST
No POST data.
COOKIES
No cookie data.
Rack ENV
Variable Value
GATEWAY_INTERFACE
CGI/1.2
HTTP_ACCEPT
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
HTTP_ACCEPT_ENCODING
gzip, deflate, sdch
HTTP_ACCEPT_LANGUAGE
en-US,en;q=0.8,en-GB;q=0.6,da;q=0.4
HTTP_CACHE_CONTROL
max-age=0
HTTP_CONNECTION
keep-alive
HTTP_HOST
localhost:3000
HTTP_UPGRADE_INSECURE_REQUESTS
1
HTTP_USER_AGENT
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36
HTTP_VERSION
HTTP/1.1
PATH_INFO
/
QUERY_STRING
REMOTE_ADDR
127.0.0.1
REQUEST_METHOD
GET
REQUEST_PATH
/
REQUEST_URI
/
SCRIPT_NAME
SERVER_NAME
localhost
SERVER_PORT
3000
SERVER_PROTOCOL
HTTP/1.1
SERVER_SOFTWARE
thin 1.6.3 codename Protein Powder
async.callback
#<Method: Thin::Connection#post_process>
async.close
#<EventMachine::DefaultDeferrable:0x00000004497b28>
rack.errors
#<Object:0x000000031c5608>
rack.input
#<StringIO:0x000000041a6860>
rack.logger
#<Rack::NullLogger:0x0000000447cd28 @app=#<Rack::Protection::FrameOptions:0x0000000447ce40 @app=#<Rack::Protection::HttpOrigin:0x0000000447cee0 @app=#<Rack::Protection::IPSpoofing:0x0000000447cf80 @app=#<Rack::Protection::JsonCsrf:0x0000000447d020 @app=#<Rack::Protection::PathTraversal:0x0000000447d0c0 @app=#<Rack::Protection::XSSHeader:0x0000000447d1d8 @app=#<ExtremeStartup::WebServer:0x00000004497a88 @default_layout=:layout, @preferred_extension=nil, @app=nil, @template_cache=#<Tilt::Cache:0x00000004497a60 @cache={}>>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :report_key=>"protection.failed", :html_types=>["text/html", "application/xhtml"], :xss_mode=>:block, :nosniff=>true, :except=>[:session_hijacking, :remote_token]}>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :report_key=>"protection.failed", :html_types=>["text/html", "application/xhtml"], :except=>[:session_hijacking, :remote_token]}>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :report_key=>"protection.failed", :html_types=>["text/html", "application/xhtml"], :except=>[:session_hijacking, :remote_token]}>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :report_key=>"protection.failed", :html_types=>["text/html", "application/xhtml"], :except=>[:session_hijacking, :remote_token]}>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :report_key=>"protection.failed", :html_types=>["text/html", "application/xhtml"], :except=>[:session_hijacking, :remote_token]}>, @options={:reaction=>:drop_session, :logging=>true, :message=>"Forbidden", :encryptor=>Digest::SHA1, :session_key=>"rack.session", :status=>403, :allow_empty_referrer=>true, :report_key=>"protection.failed", :html_types=>["text/html", "application/xhtml"], :frame_options=>:sameorigin, :except=>[:session_hijacking, :remote_token]}>>
rack.multiprocess
false
rack.multithread
true
rack.request.cookie_hash
{}
rack.request.query_hash
{}
rack.request.query_string
rack.run_once
false
rack.url_scheme
http
rack.version
[1, 0]
sinatra.accept
[#<Sinatra::Request::AcceptEntry:0x0000000425ace8 @entry="text/html", @type="text/html", @params={}, @q=1.0>, #<Sinatra::Request::AcceptEntry:0x0000000425ab08 @entry="application/xhtml+xml", @type="application/xhtml+xml", @params={}, @q=1.0>, #<Sinatra::Request::AcceptEntry:0x0000000425a5b8 @entry="image/webp", @type="image/webp", @params={}, @q=1.0>, #<Sinatra::Request::AcceptEntry:0x0000000425a928 @entry="application/xml;q=0.9", @type="application/xml", @params={}, @q=0.9>, #<Sinatra::Request::AcceptEntry:0x0000000425a428 @entry="*/*;q=0.8", @type="*/*", @params={}, @q=0.8>]
sinatra.error
#<Errno::ENOENT: No such file or directory @ rb_sysopen - c:/Users/mark/Desktop/extreme_startup/lib/extreme_startup/views/leaderboard.haml>
sinatra.route
GET /
You're seeing this error because you have enabled the show_exceptions setting.
As far as I can tell, the offending line of code is on line 28, which seems to be this:
haml :leaderboard, :locals => {
:leaderboard => LeaderBoard.new(scoreboard, players, game_state),
:players => players }
Unfortunately, my knowledge of Ruby is almost non-existent, so nothing there looks untoward to me.
When I start the web server, it produces this output, including a single warning, that I (so far unsuccessfully) have tried to get rid of. I don't know if it's related:
$ ruby web_server.rb
:public is no longer used to avoid overloading Module#public, use :public_folder or :public_dir instead
from c:/Users/mark/Desktop/extreme_startup/lib/extreme_startup/web_server.rb:20:in `<class:WebServer>'
== Sinatra (v1.4.6) has taken the stage on 3000 for development with backup from Thin
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on localhost:3000, CTRL+C to stop
When I issue the request to http://localhost:3000 from Chrome, the console outputs this error message:
WARN: tilt autoloading 'tilt/haml' in a non thread-safe way; explicit require 'tilt/haml' suggested.
2015-08-26 15:50:41 - Errno::ENOENT - No such file or directory @ rb_sysopen - c:/Users/mark/Desktop/extreme_startup/lib/extreme_startup/views/leaderboard.haml:
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/tilt-2.0.1/lib/tilt/template.rb:210:in `initialize'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/tilt-2.0.1/lib/tilt/template.rb:210:in `open'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/tilt-2.0.1/lib/tilt/template.rb:210:in `read_template_file'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/tilt-2.0.1/lib/tilt/template.rb:76:in `block in initialize'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/tilt-2.0.1/lib/tilt/template.rb:77:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/tilt-2.0.1/lib/tilt/template.rb:77:in `initialize'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:861:in `new'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:861:in `block in compile_template'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/tilt-2.0.1/lib/tilt.rb:88:in `fetch'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:840:in `compile_template'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:821:in `render'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:676:in `haml'
c:/Users/mark/Desktop/extreme_startup/lib/extreme_startup/web_server.rb:28:in `block in <class:WebServer>'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1610:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1610:in `block in compile!'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in `[]'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in `block (3 levels) in route!'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:993:in `route_eval'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in `block (2 levels) in route!'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1014:in `block in process_route'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1012:in `catch'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1012:in `process_route'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:972:in `block in route!'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:971:in `each'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:971:in `route!'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1084:in `block in dispatch!'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `block in invoke'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `catch'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `invoke'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1081:in `dispatch!'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:906:in `block in call!'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `block in invoke'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `catch'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `invoke'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:906:in `call!'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:894:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/nulllogger.rb:9:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/show_exceptions.rb:21:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:181:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:2021:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:in `block in call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1795:in `synchronize'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/eventmachine-1.0.8/lib/eventmachine.rb:1062:in `call'
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/eventmachine-1.0.8/lib/eventmachine.rb:1062:in `block in spawn_threadpool'
What's wrong, and what can I do to fix the issue?
I know almost nothing about Ruby, so it's probably a stupid beginner's mistake.
Your problem is that the application was developed a long time ago an nobody took the time to upgrade.
For example you should run it with ruby 1.9.3 which is end of live. But using a newer ruby version would probably work. (at least ruby-2.1.6 works for me)
But what definitely not works is to run this project with sinatra v1.4.6. As you can see in the source code this project was build with v1.2.6. Probably you have installed a newer version of sinatra for a other project. So I would recommend that you install the gems in your project folder with:
If installed this way you can have multiple projects with the same dependency with out a problem. But now you need to prefix you commands with bundle exec for example
bundle exec ruby web_server.rb
.Or if you are using rvm there is this thing called gemsets which does something similar.