ruby - 我不能使用rails服务器

时间:2017-04-07 18:08:32

标签: ruby-on-rails ruby bash

你好,所以我是ruby的新手,我在Windows 10上使用周年纪念更新,我可以使用bash。它随 rbenv 一起安装,每当我尝试使用 rails server 命令时,我都会收到以下错误

/home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rb-inotify-0.9.8/lib/rb-inotify/watcher.rb:74:in `initialize': Invalid argument - Failed to watch "/home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/locale": the given event mask contains no legal events; or fd is not an inotify file descriptor. (Errno::EINVAL)
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rb-inotify-0.9.8/lib/rb-inotify/notifier.rb:190:in `new'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rb-inotify-0.9.8/lib/rb-inotify/notifier.rb:190:in `watch'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rb-inotify-0.9.8/lib/rb-inotify/notifier.rb:208:in `watch'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/listen-3.0.8/lib/listen/adapter/linux.rb:32:in `_configure'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/listen-3.0.8/lib/listen/adapter/base.rb:45:in `block in configure'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/listen-3.0.8/lib/listen/adapter/base.rb:40:in `each'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/listen-3.0.8/lib/listen/adapter/base.rb:40:in `configure'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/listen-3.0.8/lib/listen/adapter/base.rb:63:in `start'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/listen-3.0.8/lib/listen/backend.rb:28:in `start'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/listen-3.0.8/lib/listen/listener.rb:67:in `block in <class:Listener>'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/listen-3.0.8/lib/listen/fsm.rb:120:in `instance_eval'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/listen-3.0.8/lib/listen/fsm.rb:120:in `call'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/listen-3.0.8/lib/listen/fsm.rb:91:in `transition_with_callbacks!'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/listen-3.0.8/lib/listen/fsm.rb:57:in `transition'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/listen-3.0.8/lib/listen/listener.rb:90:in `start'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/evented_file_update_checker.rb:90:in `boot!'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/evented_file_update_checker.rb:61:in `initialize'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/i18n_railtie.rb:59:in `new'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/i18n_railtie.rb:59:in `initialize_i18n'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/i18n_railtie.rb:15:in `block in <class:Railtie>'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:41:in `execute_hook'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:49:in `each'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/application/finisher.rb:65:in `block in <module:Finisher>'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `instance_exec'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `run'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `call'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/initializable.rb:54:in `run_initializers'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/application.rb:352:in `initialize!'
        from /home/Patrick/hello/config/environment.rb:5:in `<top (required)>'
        from /home/Patrick/hello/config.ru:3:in `require_relative'
        from /home/Patrick/hello/config.ru:3:in `block in <main>'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
        from /home/Patrick/hello/config.ru:in `new'
        from /home/Patrick/hello/config.ru:in `<main>'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/commands/server.rb:59:in `app'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rack-2.0.1/lib/rack/server.rb:353:in `wrapped_app'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/commands/server.rb:124:in `log_to_stdout'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/commands/server.rb:77:in `start'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:90:in `block in server'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `tap'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `server'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
        from /home/Patrick/hello/bin/rails:9:in `require'
        from /home/Patrick/hello/bin/rails:9:in `<top (required)>'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `load'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.1/lib/spring/client/rails.rb:28:in `call'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.1/lib/spring/client/command.rb:7:in `call'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.1/lib/spring/client.rb:30:in `run'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.1/bin/spring:49:in `<top (required)>'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `load'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.1/lib/spring/binstub.rb:31:in `<top (required)>'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
        from /home/Patrick/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
        from /home/Patrick/hello/bin/spring:15:in `<top (required)>'
        from bin/rails:3:in `load'
        from bin/rails:3:in `<main>'

1 个答案:

答案 0 :(得分:1)

试试这个:

  1. 转到config / environments / development.rb
  2. 注释掉这一行 config.file_watcher = ActiveSupport :: EventedFileUpdateChecker
  3. 然后运行bundle exec rails s
  4. 另见:

    https://github.com/rails/rails/issues/26054