簡體   English   中英

任何Rails服務器均無法啟動

[英]Any rails server doesn't start

每當嘗試使用Ruby 2.2.5和2.3.1在Ruby 4或5上啟動任何項目時,即使在新項目上,每次都遇到相同的錯誤。

試圖重新安裝rbenv,但沒有幫助。 有人有解決辦法嗎?

  fedyay@fedyay-note:~/shit$ rails s
  => Booting WEBrick
  => Rails 4.2.3 application starting in development on http://localhost:3000
  => Run `rails server -h` for more startup options
  => Ctrl-C to shutdown server
  Exiting
  /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/2.2.0/psych.rb:370:in `parse': (<unknown>): did not find expected alphabetic or numeric character while scanning an alias at line 22 column 20 (Psych::SyntaxError)
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/2.2.0/psych.rb:370:in `parse_stream'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/2.2.0/psych.rb:318:in `parse'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/2.2.0/psych.rb:245:in `load'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:391:in `secrets'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:178:in `key_generator'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:206:in `message_verifier'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/globalid-0.3.7/lib/global_id/railtie.rb:25:in `block (2 levels) in <class:Railtie>'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:36:in `call'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:44:in `each'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `run'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/2.2.0/tsort.rb:345:in `each'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/2.2.0/tsort.rb:345:in `call'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/application.rb:352:in `initialize!'
    from /home/fedyay/shit/config/environment.rb:5:in `<top (required)>'
    from /home/fedyay/shit/config.ru:3:in `require'
    from /home/fedyay/shit/config.ru:3:in `block in <main>'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
    from /home/fedyay/shit/config.ru:in `new'
    from /home/fedyay/shit/config.ru:in `<main>'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/server.rb:61:in `app'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/server.rb:139:in `log_to_stdout'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/server.rb:78:in `start'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:80:in `block in server'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/commands.rb:17:in `<top (required)>'
    from /home/fedyay/shit/bin/rails:9:in `require'
    from /home/fedyay/shit/bin/rails:9:in `<top (required)>'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/spring-2.0.0/lib/spring/client/rails.rb:28:in `load'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/spring-2.0.0/lib/spring/client/rails.rb:28:in `call'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/spring-2.0.0/lib/spring/client/command.rb:7:in `call'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/spring-2.0.0/lib/spring/client.rb:30:in `run'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/spring-2.0.0/bin/spring:49:in `<top (required)>'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/spring-2.0.0/lib/spring/binstub.rb:31:in `load'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/gems/2.2.0/gems/spring-2.0.0/lib/spring/binstub.rb:31:in `<top (required)>'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /home/fedyay/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
    from /home/fedyay/shit/bin/spring:14:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

好像您的YAML文件中有tabs而不是spaces

從編輯器設置將它們更改為空格

這里給出了類似問題的解決方案

因此,不能確定到底發生了什么,但是它以“ sudo rails s”開始就可以了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM