加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

即使它在列表中,Ruby也找不到gem

发布时间:2020-12-17 02:32:20 所属栏目:百科 来源:网络整理
导读:我有一个奇怪的问题,当我尝试运行流浪汉时,系统突然找不到json gem.当我运行vagrant时,我收到此消息: /usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find json (~ 1.5.1) amongst [Platform-0.4.0,archive-tar-minit
我有一个奇怪的问题,当我尝试运行流浪汉时,系统突然找不到json gem.当我运行vagrant时,我收到此消息:

/usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find  json (~> 1.5.1) amongst [Platform-0.4.0,archive-tar-minitar-0.5.2,builder-3.0.0,bundler-1.1.5,childprocess-0.3.5,cucumber-1.2.1,diff-lcs-1.1.3,erubis-2.7.0,ffi-1.1.5,gemcutter-0.7.1,gherkin-2.11.2,git-1.2.5,hiera-0.3.0,hiera-json-0.3.0,hiera-puppet-0.3.0,highline-1.6.13,i18n-0.6.0,json-1.7.5,log4r-1.1.10,metaclass-0.0.1,mocha-0.12.3,net-scp-1.0.4,net-ssh-2.5.2,open4-1.3.0,popen4-0.1.2,progressbar-0.11.0,puppet-module-0.3.4,puppetlabs_spec_helper-0.3.0,rake-0.9.2.2,rspec-2.11.0,rspec-core-2.11.1,rspec-expectations-2.11.2,rspec-mocks-2.11.2,rspec-puppet-0.1.4,thor-0.16.0,vagrant-1.0.3,veewee-0.2.3,virtualbox-0.9.2] (Gem::LoadError)
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/specification.rb:771:in `activate_dependencies'
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/specification.rb:760:in `each'
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/specification.rb:760:in `activate_dependencies'
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems/specification.rb:744:in `activate'
        from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:1209:in `gem'
        from /usr/local/bin/vagrant:18

正如您从上面的错误中看到的那样,json gem显然在列表中,但它无法识别它.我已经搜索过这个问题并发现了很多次,但大多数情况下,gem不存在于列表中.我没有多次安装ruby并且设置了gem路径.

宝石环境

RubyGems环境:

> RUBYGEMS版本:1.8.15
> RUBY VERSION:1.8.7(2011-06-30 patchlevel 352)[x86_64-linux]
>安装目录:/var/lib/gems/1.8
> RUBY EXECUTABLE:/usr/bin/ruby1.8
> EXECUTABLE DIRECTORY:/usr/local/bin
> RUBYGEMS PLATFORMS:

>ruby
> x86_64-linux

> GEM路径:

> /var/lib/gems/1.8
> /home/adrian/.gem/ruby/1.8

> GEM配置:

>:update_sources =>真正
>:verbose =>真正
>:benchmark =>假
>:backtrace =>假
>:bulk_threshold => 1000

>远程来源:

> http://rubygems.org/

安装目录在Ubuntu 12.04上是默认的.

宝石清单

*本地宝石*

archive-tar-minitar (0.5.2)
builder (3.0.0)
bundler (1.1.5)
childprocess (0.3.5)
cucumber (1.2.1)
diff-lcs (1.1.3)
erubis (2.7.0)
ffi (1.1.5)
gemcutter (0.7.1)
gherkin (2.11.2)
git (1.2.5)
hiera (0.3.0)
hiera-json (0.3.0)
hiera-puppet (0.3.0)
highline (1.6.13)
i18n (0.6.0)
json (1.7.5)
log4r (1.1.10)
metaclass (0.0.1)
mocha (0.12.3)
net-scp (1.0.4)
net-ssh (2.5.2)
open4 (1.3.0)
Platform (0.4.0)
popen4 (0.1.2)
progressbar (0.11.0)
puppet-module (0.3.4)
puppetlabs_spec_helper (0.3.0)
rake (0.9.2.2)
rspec (2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.2)
rspec-mocks (2.11.2)
rspec-puppet (0.1.4)
thor (0.16.0)
vagrant (1.0.3)
veewee (0.2.3)
virtualbox (0.9.2)

正如您所看到的,gem位于安装列表中.未设置环境变量$GEM_HOME和$GEM_PATH.

我一直在试图解决这个问题,但目前我处于亏损状态.任何来自Ruby和/或Vagrant专家的帮助将不胜感激.

解决方法

正如您在此处指出的那样,您已经安装了json gem version 1.7.5.但是你得到的错误信息状态找不到json(?> 1.5.1). ?>语法意味着只接受1.5.x版本!因此,您需要安装其中一个以满足依赖性.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读