简体   繁体   中英

Could not find 'rubyzip' (~> 1.0)

When trying to execute my ruby script I receive the following error message

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

    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"

My script is the sample ruby script on seleniumhq page.

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. I needed to

  • download the gem into my system
  • navigate to the folder
  • execute gem install --force --local *.gem

When I did the above steps the gem was installed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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