2015-08-26 2 views
0

Я пытаюсь настроить и запустить кодировку dojo на моей машине с Windows.Ошибка при работе с Extreme Startup Sinatra web server

Когда я пытаюсь получить доступ к первой странице на http://localhost:3000, я получаю эту ошибку:

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. 

Насколько я могу судить, мешающий строка кода в строке 28, which seems to be this:

haml :leaderboard, :locals => { 
    :leaderboard => LeaderBoard.new(scoreboard, players, game_state), 
    :players => players } 

К сожалению, мои знания о Ruby почти не существуют, поэтому нет ничего неприятного для меня.

Когда я запускаю веб-сервер, он производит этот вывод, включая одно предупреждение, которое я (до сих пор безуспешно) пытался избавиться. Я не знаю, если это связано:

$ 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 

Когда я выполняю запрос http://localhost:3000 от Chrome, консоль выводит сообщение об ошибке:

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' 

Что случилось, и что я могу сделать, чтобы исправить проблема?

Я почти ничего не знаю о Ruby, так что это, наверное, ошибка глупого новичка.

+1

Я думаю, вы проверили, что 'c:/Users/mark/Desktop/extreme_startup/lib/extreme_startup/views/leaderboard.haml' существует? –

+0

@ Sirl33tname На самом деле у меня не было: $ Я просто [клонировал репозиторий] (https://github.com/rchatley/extreme_startup) и наивно полагал, что все будет работать. Как вы, возможно, догадались, файла нет. Нужно ли мне как-то «создавать» приложение, чтобы этот файл (и другие) появился? Может ли проблема быть связана с предупреждением о ': public'? –

+0

Я не использую git с окнами, но я просто проверил это с git на linux, и у меня есть этот файл, поэтому я думаю, что что-то пошло не так в git checkout. Предупреждение об установке общих папок - это просто предупреждение. Я не уверен на 100%, если он может создавать проблемы, но я уверен, что это не связано с вашей проблемой. –

ответ

1

Ваша проблема в том, что приложение было разработано давно, и никто не успел обновиться.

Например, вы должны запустить его с ruby ​​1.9.3, который является концом жизни. Но использование новой рубиновой версии, вероятно, сработает. (по крайней мере ruby-2.1.6 работает для меня)

Но что, безусловно, не работает, чтобы запустить этот проект с помощью синатра v1.4.6. Как вы можете видеть в исходном коде, этот проект был построен с v1.2.6. Возможно, вы установили новую версию синатра для другого проекта. Поэтому я рекомендую вам установить драгоценные камни в вашей папке проекта с:

bundle install --binstubs --path vendor

Если установлен таким образом, вы можете иметь несколько проектов с той же зависимостью с вне проблемы. Но теперь вам нужно префиксные команды с помощью команды bundle exec например bundle exec ruby web_server.rb.

Или, если вы используете rvm, эта вещь называется gemsets, которая делает что-то подобное.

+0

Спасибо. Проблема с этой командой заключается в том, что если я ее выдаю, я столкнулся с [этой проблемой] (http://stackoverflow.com/q/32224128/126014). Есть ли способ преодолеть оба препятствия? –

+0

Можете ли вы заменить свой Gemfile.lock на этот http://pastebin.com/xCBfeTkV и повторить попытку? –

+0

Спасибо за ваши усилия. Теперь он проходит шаг nokogiri, но затем он не работает при установке 'ffi'. Это довольно массивное сообщение об ошибке, поэтому я почти не осмеливаюсь публиковать его. Я думаю, что опубликую проблему в репо и посмотрю, интересует ли автор оригинальный код. Большое вам спасибо за ваши добрые усилия. –

Смежные вопросы