红宝石 紫外线、导轨、豹纹

Posted

技术标签:

【中文标题】红宝石 紫外线、导轨、豹纹【英文标题】:Ruby Gem Ultraviolet, Rails, Leopard 【发布时间】:2011-04-04 00:08:58 【问题描述】:

我无法让这种疯狂的依赖发挥作用,请不要因为我有 PPC 而告诉我去 Snow Leopard。

我已经安装了oniguruma、textpow、紫外线。我正在使用 rvm 这可能是问题所在。不是 rvm 不好,只是我不知道如何让路径正确。

当我启动一个 Rails 应用程序时,我收到的错误是我错过了 ultraviolet gem,事实并非如此,因为它与其他正常工作的 gem 一起列在 gem list 下。

如果您需要更多信息以及具体的信息,请告诉我:

这是我的错误日志:

Macintosh:sam samgilman$ 脚本/服务器 => 启动 WEBrick => Rails 2.3.5 应用程序开始于http://0.0.0.0:3000 /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements 已弃用并将被删除2010 年 8 月或之后。使用#requirement 没有要加载的文件 -- 紫外线 /Users/samgilman/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' /Users/samgilman/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in require' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:innew_constants_in' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in require' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/rails/gem_dependency.rb:208:inload' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/initializer.rb:307:in load_gems' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/initializer.rb:307:ineach' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/initializer.rb:307:in load_gems' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/initializer.rb:164:inprocess' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/initializer.rb:113:in send' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/initializer.rb:113:inrun' /Users/samgilman/Sites/sam/config/environment.rb:9 /Users/samgilman/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' /Users/samgilman/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in require' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:innew_constants_in' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in require' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/commands/server.rb:84 /Users/samgilman/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require' /Users/samgilman/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require' script/server:3 no such file to load -- ultraviolet /Users/samgilman/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require' /Users/samgilman/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/rails/gem_dependency.rb:208:in load' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/initializer.rb:307:inload_gems' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/initializer.rb:307:in each' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/initializer.rb:307:inload_gems' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/initializer.rb:169:in process' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/initializer.rb:113:insend' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/initializer.rb:113:in run' /Users/samgilman/Sites/sam/config/environment.rb:9 /Users/samgilman/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require' /Users/samgilman/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in new_constants_in' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:inrequire' /Users/samgilman/.rvm/gems/ruby-1.8.7-p302/gems/rails-2.3.5/lib/commands/server.rb:84 /Users/samgilman/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' /Users/samgilman/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire' 脚本/服务器:3 缺少这些必需的宝石: 紫外线 你正在运行: ruby 1.8.7.302 在 /Users/samgilman/.rvm/rubies/ruby-1.8.7-p302/bin/ruby rubygems 1.3.7 位于 /Users/samgilman/.rvm/gems/ruby-1.8.7-p302、/Users/samgilman/.rvm/gems/ruby-1.8.7-p302@global 运行 rake gems:install 以安装缺少的 gem。 Macintosh:sam samgilman$

【问题讨论】:

也许在这里发布您的gem env 确保您使用的是您认为的 ruby​​ 版本。您也可以尝试在 environment.rb 中调整您的 gem 路径。总帐。 【参考方案1】:

对于 Rails 3、Rails 4 和 Rails 5,你应该有Gemfile

gem "ultraviolet", :require => "uv"

【讨论】:

【参考方案2】:

I didn't add :lib => 'uv'

Rails::Initializer.run do |config|
    config.gem 'ultraviolet', :lib => 'uv'
end

【讨论】:

【参考方案3】:

安装 gem 与在 Rails 配置中声明它不同,尽管它是一个重要的先决条件。

确保您的 config/environment.rb 至少设置了:

Rails::Initializer.run do |config|
  config.gem 'ultraviolet'
end

在您使用gem 命令声明它们之前,不会自动加载宝石。也许它很顽固,所以试试这个:

% irb
> require 'rubygems'
 => true
> gem 'ultraviolet'
 => true
> $:.grep(/ultraviolet/)
 => [...]

最后一行应该显示库 $: 的加载路径已调整为使用您的 rvm 托管 gem。它可能会丢失或不正确,这会阻止 gem 正确加载。

如果您使用的是 RVM 并且您的环境不一致,通常很容易运行错误的 rubyirb。如果您不小心自己的路径,gem 经常会绑定到错误的 ruby​​。

【讨论】:

以上是关于红宝石 紫外线、导轨、豹纹的主要内容,如果未能解决你的问题,请参考以下文章

Rails:红宝石在导轨上的未知属性错误

安装导轨时出错

导轨设计,没有路线匹配注销

ruby 导轨のテスト用宝石リスト(デフォルトでインストールされているものを除く)

hashie / extensions / dash / indifferent_access(LoadError)导轨

从滑轨3.2升级到导轨4