Я не могу запустить сервер rails - PullRequest
0 голосов
/ 05 июля 2018

Я пытаюсь создать свое первое приложение для rails, однако, когда я пытаюсь запустить rails server, оно просто дает мне груз текста. Я запускаю это на Arch Linux и использовал пакет ruby-rails от AUR.

это то, что он мне дает при попытке запустить команду

[drew@rhino sophia]$ rails server
=> Booting Puma
=> Rails 5.2.0 application starting in development 
=> Run `rails server -h` for more startup options
Exiting
Traceback (most recent call last):
        70: from bin/rails:3:in `<main>'
        69: from bin/rails:3:in `load'
        68: from /home/drew/work/spproject/sophia/sophia/bin/spring:15:in `<top (required)>'
        67: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:70:in `require'
        66: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:70:in `require'
        65: from /usr/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
        64: from /usr/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
        63: from /usr/lib/ruby/gems/2.5.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
        62: from /usr/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
        61: from /usr/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
        60: from /usr/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
        59: from /usr/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
        58: from /home/drew/work/spproject/sophia/sophia/bin/rails:9:in `<top (required)>'
        57: from /usr/lib/ruby/gems/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
        56: from /usr/lib/ruby/gems/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
        55: from /usr/lib/ruby/gems/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
        54: from /usr/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
        53: from /usr/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
        52: from /usr/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
        51: from /usr/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
        50: from /usr/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
        49: from /home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands.rb:18:in `<main>'
        48: from /home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/command.rb:46:in `invoke'
        47: from /home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/command/base.rb:65:in `perform'
        46: from /usr/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
        45: from /usr/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
        44: from /usr/lib/ruby/gems/2.5.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
        43: from /home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `perform'
        42: from /home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:142:in `tap'
        41: from /home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:147:in `block in perform'
        40: from /home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:51:in `start'
        39: from /home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:89:in `log_to_stdout'
        38: from /usr/lib/ruby/gems/2.5.0/gems/rack-2.0.5/lib/rack/server.rb:354:in `wrapped_app'
        37: from /home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/server/server_command.rb:27:in `app'
        36: from /usr/lib/ruby/gems/2.5.0/gems/rack-2.0.5/lib/rack/server.rb:219:in `app'
        35: from /usr/lib/ruby/gems/2.5.0/gems/rack-2.0.5/lib/rack/server.rb:319:in `build_app_and_options_from_config'
        34: from /usr/lib/ruby/gems/2.5.0/gems/rack-2.0.5/lib/rack/builder.rb:40:in `parse_file'
        33: from /usr/lib/ruby/gems/2.5.0/gems/rack-2.0.5/lib/rack/builder.rb:49:in `new_from_string'
        32: from /usr/lib/ruby/gems/2.5.0/gems/rack-2.0.5/lib/rack/builder.rb:49:in `eval'
        31: from config.ru:in `<main>'
        30: from config.ru:in `new'
        29: from /usr/lib/ruby/gems/2.5.0/gems/rack-2.0.5/lib/rack/builder.rb:55:in `initialize'
        28: from /usr/lib/ruby/gems/2.5.0/gems/rack-2.0.5/lib/rack/builder.rb:55:in `instance_eval'
        27: from config.ru:3:in `block in <main>'
        26: from /usr/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:44:in `require_relative'
        25: from /usr/lib/ruby/gems/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `require'
        24: from /usr/lib/ruby/gems/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:249:in `load_dependency'
        23: from /usr/lib/ruby/gems/2.5.0/gems/activesupport-5.2.0/lib/active_support/dependencies.rb:283:in `block in require'
        22: from /usr/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
        21: from /usr/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
        20: from /usr/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
        19: from /usr/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
        18: from /usr/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
        17: from /home/drew/work/spproject/sophia/sophia/config/environment.rb:5:in `<main>'
        16: from /home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:361:in `initialize!'
        15: from /home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:60:in `run_initializers'
        14: from /usr/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
        13: from /usr/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
        12: from /usr/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
        11: from /usr/lib/ruby/2.5.0/tsort.rb:347:in `call'
        10: from /usr/lib/ruby/2.5.0/tsort.rb:347:in `each'
         9: from /usr/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
         8: from /usr/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
         7: from /usr/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
         6: from /usr/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
         5: from /home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:61:in `block in run_initializers'
         4: from /home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `run'
         3: from /home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `instance_exec'
         2: from /usr/lib/ruby/gems/2.5.0/gems/activesupport-5.2.0/lib/active_support/railtie.rb:42:in `block in <class:Railtie>'
         1: from /usr/lib/ruby/gems/2.5.0/gems/activesupport-5.2.0/lib/active_support/core_ext/time/zones.rb:82:in `find_zone!'
/usr/lib/ruby/gems/2.5.0/gems/activesupport-5.2.0/lib/active_support/core_ext/time/zones.rb:100:in `rescue in find_zone!': Invalid Timezone: UTC (ArgumentError)

РЕДАКТИРОВАТЬ драгоценный камень env

RubyGems Environment:
  - RUBYGEMS VERSION: 2.7.7
  - RUBY VERSION: 2.5.1 (2018-03-29 patchlevel 57) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/2.5.0
  - USER INSTALLATION DIRECTORY: /home/drew/.gem/ruby/2.5.0
  - RUBY EXECUTABLE: /usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin
  - SPEC CACHE DIRECTORY: /home/drew/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/lib/ruby/gems/2.5.0
     - /home/drew/.gem/ruby/2.5.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--user-install"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/local/sbin
     - /usr/lib/jvm/default/bin
     - /usr/bin/site_perl
     - /usr/bin/vendor_perl
     - /usr/bin/core_perl

паста $ PATH

/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

Паста аппликации.rb

require_relative 'boot'

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module Sophia
  class Application < Rails::Application
    # Initialize configuration defaults for originally generated Rails version.
    config.load_defaults 5.2

    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration can go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded after loading
    # the framework and any gems in your application.
  end
end


Paster of rails migrate:db

rails aborted!
ArgumentError: Invalid Timezone: UTC
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `instance_exec'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `run'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:61:in `block in run_initializers'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:60:in `run_initializers'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:361:in `initialize!'
/home/drew/work/spproject/sophia/sophia/config/environment.rb:5:in `<main>'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:337:in `require_environment!'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:520:in `block in run_tasks_blocks'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/command.rb:48:in `invoke'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands.rb:18:in `<main>'
/home/drew/work/spproject/sophia/sophia/bin/rails:9:in `<top (required)>'
/home/drew/work/spproject/sophia/sophia/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

Caused by:
TZInfo::InvalidTimezoneIdentifier: Expected 44 bytes reading '/usr/share/zoneinfo/UTC', but got 0 bytes
/home/drew/.gem/ruby/2.5.0/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_data_source.rb:205:in `rescue in load_timezone_info'
/home/drew/.gem/ruby/2.5.0/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_data_source.rb:202:in `load_timezone_info'
/home/drew/.gem/ruby/2.5.0/gems/tzinfo-1.2.5/lib/tzinfo/timezone.rb:92:in `get'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `instance_exec'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `run'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:61:in `block in run_initializers'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:60:in `run_initializers'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:361:in `initialize!'
/home/drew/work/spproject/sophia/sophia/config/environment.rb:5:in `<main>'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:337:in `require_environment!'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:520:in `block in run_tasks_blocks'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/command.rb:48:in `invoke'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands.rb:18:in `<main>'
/home/drew/work/spproject/sophia/sophia/bin/rails:9:in `<top (required)>'
/home/drew/work/spproject/sophia/sophia/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'

Caused by:
TZInfo::InvalidZoneinfoFile: Expected 44 bytes reading '/usr/share/zoneinfo/UTC', but got 0 bytes
/home/drew/.gem/ruby/2.5.0/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_timezone_info.rb:53:in `check_read'
/home/drew/.gem/ruby/2.5.0/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_timezone_info.rb:169:in `parse'
/home/drew/.gem/ruby/2.5.0/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_timezone_info.rb:28:in `block in initialize'
/home/drew/.gem/ruby/2.5.0/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_timezone_info.rb:27:in `open'
/home/drew/.gem/ruby/2.5.0/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_timezone_info.rb:27:in `initialize'
/home/drew/.gem/ruby/2.5.0/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_data_source.rb:203:in `new'
/home/drew/.gem/ruby/2.5.0/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_data_source.rb:203:in `load_timezone_info'
/home/drew/.gem/ruby/2.5.0/gems/tzinfo-1.2.5/lib/tzinfo/timezone.rb:92:in `get'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `instance_exec'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:32:in `run'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:61:in `block in run_initializers'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/initializable.rb:60:in `run_initializers'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:361:in `initialize!'
/home/drew/work/spproject/sophia/sophia/config/environment.rb:5:in `<main>'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:337:in `require_environment!'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/application.rb:520:in `block in run_tasks_blocks'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/command.rb:48:in `invoke'
/home/drew/.gem/ruby/2.5.0/gems/railties-5.2.0/lib/rails/commands.rb:18:in `<main>'
/home/drew/work/spproject/sophia/sophia/bin/rails:9:in `<top (required)>'
/home/drew/work/spproject/sophia/sophia/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:migrate => db:load_config => environment
(See full trace by running task with --trace)

Ответы [ 3 ]

0 голосов
/ 05 июля 2018

Возможно, вы ожидаете миграции. Попробуйте запустить:

rails db:migrate
0 голосов
/ 05 июля 2018

Добавьте time_zone в ваш конфигурационный файл,

config.time_zone = 'Australia/Melbourne'

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

config.time_zone = 'UTC'
0 голосов
/ 05 июля 2018

См. config/application.rb раздел config.time_zone.

Вы можете запустить rake -D time, чтобы показать все доступные часовые пояса.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...