简体   繁体   English

找不到'rubyzip'(〜> 1.0)

[英]Could not find 'rubyzip' (~> 1.0)

When trying to execute my ruby script I receive the following error message 尝试执行我的ruby脚本时,收到以下错误消息

C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/dependency.rb:308:in `to_specs': Could 
not find 'rubyzip' (~> 1.0) among 14 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=C:/Users/me/.gem/ruby/2.4.0;C:/Ruby24-
x64/lib/ruby/gems/2.4.0', execute `gem env` for more information
        from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/specification.rb:1442:in 
`block in activate_dependencies'
        from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/specification.rb:1431:in 
`each'
    from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/specification.rb:1431:in 
`activate_dependencies'
    from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/specification.rb:1413:in 
`activate'
    from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems.rb:220:in `rescue in 
try_activate'
    from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems.rb:213:in `try_activate'
    from C:/Ruby24-
x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:126:in `rescue in 
require'
    from C:/Ruby24-
x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:40:in `require'
    from setupscript.rb:2:in `<main>'

I run gem env and the following is returned 我运行gem env并返回以下内容

    RubyGems Environment:
   - RUBYGEMS VERSION: 2.6.11
  - RUBY VERSION: 2.4.1 (2017-03-22 patchlevel 111) [x64-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby24-x64/lib/ruby/gems/2.4.0
  - USER INSTALLATION DIRECTORY: C:/Users/me/.gem/ruby/2.4.0
  - RUBY EXECUTABLE: C:/Ruby24-x64/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby24-x64/bin
  - SPEC CACHE DIRECTORY: C:/Users/me/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
  - RUBYGEMS PLATFORMS:
    - ruby
    - x64-mingw32
    - GEM PATHS:
 - C:/Ruby24-x64/lib/ruby/gems/2.4.0
 - C:/Users/me/.gem/ruby/2.4.0
  - GEM CONFIGURATION:
 - :update_sources => true
 - :verbose => true
 - :backtrace => false
 - :bulk_threshold => 1000
 - :sources => []
  - REMOTE SOURCES:
  - SHELL PATH:
     - C:\Program Files\ConEmu\ConEmu\Scripts
     - C:\Program Files\ConEmu
     - C:\Program Files\ConEmu\ConEmu
     - C:\ProgramData\Oracle\Java\javapath
     - C:\Windows\system32
      - C:\Windows
 - C:\Windows\System32\Wbem
 - C:\Windows\System32\WindowsPowerShell\v1.0\
 - C:\Program Files (x86)\Oracle\instantclient_11_2
 - C:\Program Files (x86)\WebEx\Productivity Tools
 - C:\Program Files\nodejs\
 - C:\Program Files (x86)\Silk\SilkTest
 - C:\Program Files (x86)\Silk\SilkTest\ng\gui
 - C:\Program Files\Microsoft SQL Server\130\Tools\Binn\
 - C:\Program Files\dotnet\
 - C:\Ruby24-x64\bin

C:\\Users\\me\\AppData\\Local\\Microsoft\\WindowsApps,C:\\Users\\me\\Documents\\Automation\\SeleniumBrowserDrivers\\IEDriverServer_Win32_3.4.0\\ - C:\\Users\\me\\AppData\\Local\\Programs\\Fiddler - C:\\Users\\me\\AppData\\Roaming\\npm" C:\\ Users \\ me \\ AppData \\ Local \\ Microsoft \\ WindowsApps,C:\\ Users \\ me \\ Documents \\ Automation \\ SeleniumBrowserDrivers \\ IEDriverServer_Win32_3.4.0 \\-C:\\ Users \\ me \\ AppData \\ Local \\ Programs \\ Fiddler-C: \\用户\\我\\应用程序数据\\漫游\\ NPM”

My script is the sample ruby script on seleniumhq page. 我的脚本是seleniumhq页面上的示例ruby脚本。

require 'rubygems'
require 'selenium-webdriver'

driver = Selenium::WebDriver.for :IE
driver.get "http://google.com"

element = driver.find_element :name => "q"
element.send_keys "Cheese!"
element.submit

puts "Page title is #{driver.title}"

wait = Selenium::WebDriver::Wait.new(:timeout => 10)
wait.until { driver.title.downcase.start_with? "cheese!" }

 puts "Page title is #{driver.title}"
driver.quit

Thanks, Scott 谢谢,斯科特

For some reason I was unable to install rubyzip. 由于某种原因,我无法安装rubyzip。 I needed to 我需要

  • download the gem into my system 将宝石下载到我的系统中
  • navigate to the folder 导航到文件夹
  • execute gem install --force --local *.gem 执行gem install --force --local * .gem

When I did the above steps the gem was installed. 当我执行上述步骤时,gem已安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM