env 配置文件中未初始化的常量 ActiveSupport::EventedFileUpdateChecker

2024-05-09

我是 Ruby on Rails 的新手。运行“捆绑”命令进行更新/安装后,当我尝试执行以下操作时rails s or rails g mongoid:config控制台返回以下消息开头:

/home/myUser/proyect/config/environments/development.rb:50:in `block in <top (required)>': uninitialized constant ActiveSupport::EventedFileUpdateChecker (NameError)

这是我的 Gemfile(是的,我想使用 MongoDB 作为数据库):

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Mongoid as the database
gem 'mongoid', '~> 5.1.0'
# Use bson
gem 'bson_ext'
# Use Puma as the app server
gem 'puma', '~> 3.0'
#Use Haml for html
gem 'haml'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5.x'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platform: :mri
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console'
  gem 'listen', '~> 3.0.5'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

And the 配置/环境/development.rb file:

Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # In the development environment your application's code is reloaded on
  # every request. This slows down response time but is perfect for development
  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Do not eager load code on boot.
  config.eager_load = false

  # Show full error reports.
  config.consider_all_requests_local = true

  # Enable/disable caching. By default caching is disabled.
  if Rails.root.join('tmp/caching-dev.txt').exist?
    config.action_controller.perform_caching = true

    config.cache_store = :memory_store
    config.public_file_server.headers = {
      'Cache-Control' => 'public, max-age=172800'
    }
  else
    config.action_controller.perform_caching = false

    config.cache_store = :null_store
  end

  # Don't care if the mailer can't send.
  config.action_mailer.raise_delivery_errors = false

  config.action_mailer.perform_caching = false

  # Print deprecation notices to the Rails logger.
  config.active_support.deprecation = :log

  # Raise an error on page load if there are pending migrations.
  config.active_record.migration_error = :page_load

  # Debug mode disables concatenation and preprocessing of assets.
  # This option may cause significant delays in view rendering with a large
  # number of complex assets.
  config.assets.debug = true

  # Raises error for missing translations
  # config.action_view.raise_on_missing_translations = true

  # Use an evented file watcher to asynchronously detect changes in source code,
  # routes, locales, etc. This feature depends on the listen gem.
  config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end

根据Rails 变更日志 https://allmychanges.com/p/ruby/rails/#5.0, config.file_watcher选项已被引入Rails 5。它允许您根据文件更改自动重新加载。此功能取决于listenergem,并且您已将其列在您的 gemfile 中。但我觉得可疑的是你的Rails版本!

gem 'rails', '4.2.6'
# but rails 4 does not support that feature!

看起来你有一个 Gemfile(或development.rb配置?)从另一个版本复制Rails框架、另一个项目,或者手动将您的 gemfile 版本更改为不适当的状态。

我可以建议你的两个选择是:

  1. 要将 Rails gemfile 版本更改为最前沿的版本,如下所示:

    gem 'rails', github: 'rails/rails'
    

    And bundle再一次;

  2. 去除config.file_watcher您的配置文件中的行。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

env 配置文件中未初始化的常量 ActiveSupport::EventedFileUpdateChecker 的相关文章

  • 如何使用 Rspec 测试具有嵌套路由的控制器?

    我有 2 个使用轨道脚手架生成器创建的控制器 我希望它们嵌套在一个名为 demo 的文件夹中 所以运行 rails g scaffold demo flows rails g scaffold demo nodes 然后我决定将节点嵌套在流
  • Rails/Nginx 中的超时——最佳实践

    我正在开发一个应该在 Nginx 服务器上运行的 Rails 应用程序 根据输入 应用程序可能需要很长时间来处理请求 或者在出现错误时挂起 因此我想防止进程永远运行 除了确保客户端收到超时信号的 Nginx 配置之外 我想我可能仍然需要确保
  • rvm gem 安装错误?

    我正在摆弄 ruby gems 和 rvm 它工作得很好 但现在当我尝试安装 gem 时出现错误 gem install Rails错误 同时 执行 gem Errno EACCES 权限被拒绝 Users da rvm gems ruby
  • 获取嵌套参数

    我有一个带有嵌套参数的表单 在下面的示例中 如何获取控制器中的 amount whole 值 Parameters utf8 gt authenticity token gt KCmBI6RLh0LdUsM2r5H1vhNykS1IXecF
  • Bundle 说 gem 丢失了 - 但事实并非如此?

    背景 我正在维护contentRuby On Rails 站点 但我确实没有 Rails 的经验 当尝试运行 Rails 服务器时 rails s我明白了 在任何来源中均找不到 activesupport 3 2 0 Run bundle
  • 如何为 ApplicationController 中 after_action 过滤器中的所有操作渲染 json?

    是否可以在 Rails ApplicationController 中创建一个 after filter 方法 该方法在每个操作上运行并呈现为 JSON 我正在构建一个 API 并且希望将控制器中的每个操作的输出呈现为 JSON 客户控制器
  • RoR - Rails 中的大文件上传

    我有一个 Rails Web 应用程序 允许用户上传视频 视频存储在 NFS 安装的目录中 当前的设置适用于较小的文件 但我也需要支持大文件上传 最多 4GB 当我尝试上传 4GB 文件时 它最终会发生 但从用户体验的角度来看很糟糕 上传开
  • 如何在 Ruby 2.2 上删除不安全密码来强化 Rails+webrick+https

    更新 首先 我的测试代码没有充分显示 ruby 2 4 看到 SSLCiphers 选项 而 ruby 2 2 没有 我编辑了下面的示例代码以清楚地表明这一点 更新 由于我的问题未能得到社区的任何帮助 我继续前进 两天后找到了解决方案 我将
  • Rails 安全:完全避免大规模分配

    我倾向于不需要批量分配 http guides rubyonrails org security html mass assignment我的生产代码中的功能 在我的测试代码中 我经常使用它 但在这些情况下我do想要设置任意列 因此 如果在
  • 带有 git Remote 的 Gem 文件在 Heroku 推送上失败

    我的 gemfile 中有以下行 gem client side validations git gt email protected cdn cgi l email protection Dakuan client side valida
  • 子文件夹和关系中的 Rails 模型

    我在自动加载的文件夹中组织了一些轨道模型 config autoload paths Dir Rails root join app models 我可以直接使用所有模型 例如Image first file name 但是当我尝试通过关系
  • 高效地重新安排 ActiveJob (resque/sidekiq)

    我正在玩Rails 4 2应用程序使用ActiveJob受支持resque sidekiq用于电子邮件安排 当用户创建时事通讯活动时 会创建一个新作业并安排在特定日期 这一切都很好 但是当用户更改交货日期时会发生什么 在这种情况下 每个作业
  • PHP 的脚手架 [关闭]

    Closed 这个问题是无关 help closed questions 目前不接受答案 PHP 中有什么东西可以像 Rails 一样创建基本的脚手架吗 编辑 我需要一些东西来快速原型化 一些框架比如Symfony http www sym
  • Rails 3.2:用 json 序列化中的空字符串替换 null 值

    我正在使用 Rails 3 2序列化 http www simonecarletti com blog 2010 04 inside ruby on rails serializing ruby objects with json 将 ru
  • 在 Rails 中本地化嵌套虚拟属性

    怎么可能本地化嵌套虚拟属性在 Rails 中 该模型 class User lt ActiveRecord Base attr accessor company information This is used in callbacks e
  • 在 Rails 项目中保存自定义异常定义的常规位置是什么? [关闭]

    Closed 这个问题是基于意见的 help closed questions 目前不接受答案 当创建自己的自定义异常时 例如 class ThingExploded lt StandardError end class ThingIsMi
  • 如何根据域名更改视图格式

    我想知道是否有任何方法可以根据域名更改相同 Rails 应用程序的视图格式 例如 www domain com gt respond to format html api domain com gt respond to format xm
  • 如何通过 Ruby 中的代理获取带有用户代理和超时的 URL?

    如果我需要通过某些方式获取 URL 我该如何获取 URLproxy 它必须有一个timeout最大 n 秒 和一个用户代理 require nokogiri require net http require rexml document d
  • 将对象转换为哈希,然后将其保存到用户的列

    找不到任何接近我想做的事情 我想将一个对象存储到用户的列中 该列采用数组的形式 postgres def change add column users interest string array true default end 我有另一
  • Rails 6:每个用户只能创建一个配置文件

    我目前正在开发 Rails 6 应用程序 我有以下关联 用户有一个配置文件 并且配置文件属于用户 当编辑用户的配置文件时 我最终为该用户提供了两个配置文件 我希望每个用户只有一份个人资料 编辑表单 profile edit html erb

随机推荐