gpt4 book ai didi

ruby - 无法在 ruby​​ 2.1.5 中加载 `active_support/core_ext`

转载 作者:数据小太阳 更新时间:2023-10-29 08:03:52 25 4
gpt4 key购买 nike

当我需要 'active_support/core_ext' 时,出现错误:

NameError: uninitialized constant ActiveSupport::Autoload from /opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/number_helper.rb:3:in `<module:NumberHelper>'

当然我安装了activesupport gem。

# gem list --local | grep activesupport
activesupport (4.2.0)

我应该安装一些其他的 gem 来使用 active_support/core_ext 吗?

我在 Ubuntu14.04 中使用 ruby 2.1.5p273

最佳答案

假设您正在使用 bundler ,请尝试使用此诊断代码以查看有效方法:

require 'rubygems'        # You may be able to omit this line
require 'bundler/setup' # You may be able to omit this line
require 'active_support'
require 'active_support/core_ext'

较新的 Ruby 版本可能会跳过 rubygemssetupcore_ext,而只需使用它:

require 'active_support'

关于ruby - 无法在 ruby​​ 2.1.5 中加载 `active_support/core_ext`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27674040/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com