Ruby无法找到已安装的宝石窗口10

时间:2016-05-18 10:29:45

标签: ruby rubygems

运行包含以下内容的脚本时

`require': cannot load such file -- zip

我正在

gem install rubyzip

首先,我尝试像这样安装' ruby​​zip'

>gem env
RubyGems Environment:
RUBYGEMS VERSION: 2.4.8
RUBY VERSION: 2.2.3 (2016-01-26 patchlevel 0) [java]
INSTALLATION DIRECTORY: C:/jruby-9.0.5.0/lib/ruby/gems/shared
RUBY EXECUTABLE: C:/jruby-9.0.5.0/bin/jruby.exe
EXECUTABLE DIRECTORY: C:/jruby-9.0.5.0/bin
SPEC CACHE DIRECTORY: C:/Users/lucio/.gem/specs
SYSTEM CONFIGURATION DIRECTORY: C:/jruby-9.0.5.0/etc
RUBYGEMS PLATFORMS:
- ruby
- universal-java-1.8
GEM PATHS:
 - C:/jruby-9.0.5.0/lib/ruby/gems/shared
 - C:/Users/lucio/.gem/jruby/2.2.0

在观看gem env时:

irb(main):001:0> require 'zip'
=> true
irb中的

似乎需要工作

>bundle show
Gems included by the bundle:
* bundler (1.12.4)
* rubyzip (1.2.0)

我还尝试在安装

后使用bundler进行安装
>bundler exec ruby zip.rb
Could not find rubyzip-1.2.0 in any of the sources
Run `bundle install` to install missing gems.

但是在运行我的脚本时我得到了

>gem list -l

*** LOCAL GEMS ***

bundler (1.12.4)
jar-dependencies (0.2.3)
jruby-openssl (0.9.15 java)
jruby-win32ole (0.8.5)
json (1.8.0 java)
minitest (5.4.1)
power_assert (0.2.3)
psych (2.0.15 java)
racc (1.4.13 java)
rake (10.1.0)
rdoc (4.1.2)
rubygems-update (2.6.4)
rubyzip (1.2.0)

我也可以在宝石列表中看到它

d - Short Date,
D - Long Date,
f - full date with time,
t - time,
s - time with seconds.

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:2)

发现问题。 我和Jruby一起安装了Ruby,所以在安装gem的时候它会自动安装在Jruby目录下,以后不会发现Ruby从PATH端变量中删除Jruby解决了问题