Could not find 'rubyzip' (~> 1.0) - ruby

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.

Related

Can't require ruby gems on windows 10

I have installed ruby -v 2.2.4 (64x) on Windows 10 from it's official website. The setup completed successfully, but ruby isn't able to require gems. Whenever I run the following command from IRB:
require 'minitest'
It fails with the output:
LoadError: cannot load such file --
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in
'require'
from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in
'require'
from (irb):1
from C:/Ruby22-x64/bin/irb:11:in '< main>'
Gem list:
bigdecimal (1.2.6)
io-console (0.4.3)
json (1.8.1)
minitest (5.4.3)
power_assert (0.2.2)
psych (2.0.8)
rake (10.4.2)
rdoc (4.2.0)
test-unit (3.0.8)
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5.1
- RUBY VERSION: 2.2.4 (2015-12-16 patchlevel 230) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby22/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE: C:/Ruby22/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby22/bin
- SPEC CACHE DIRECTORY: C:/Users/alexl/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- C:/Ruby22/lib/ruby/gems/2.2.0
- C:/Users/alexl/.gem/ruby/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- C:\Users\alexl\bin
- C:\Program Files\Git\mingw64\bin
- C:\Program Files\Git\usr\local\bin
- C:\Program Files\Git\usr\bin
- C:\Program Files\Git\usr\bin
- C:\Program Files\Git\mingw64\bin
- C:\Program Files\Git\usr\bin
- C:\Users\alexl\bin
- C:\ProgramData\Oracle\Java\javapath
- C:\Windows\system32
- C:\Windows
- C:\Windows\System32\Wbem
- C:\Windows\System32\WindowsPowerShell\v1.0
- C:\Program Files (x86)\Skype\Phone
- C:\HashiCorp\Vagrant\bin
- C:\Program Files (x86)\EaseUS\Todo Backup\bin
- C:\wamp\bin\php\php5.6.15
- C:\ProgramData\ComposerSetup\bin
- C:\Ruby22\bin
- C:\Users\alexl\AppData\Local\atom\bin
- C:\Program Files\Git\usr\bin\vendor_perl
- C:\Program Files\Git\usr\bin\core_perl
I have googled around for some time, but could not find any useful information about resolving this issue.
Edit 1
I have uninstalled the x64 version and installed the x86 one. The error still persists

Cannot run Jekyll on Ubuntu 12.04

I encountered this issue:
gabriele # osiris { ~ } [ ven nov 15 ] [ 12:57 ]
> jekyll
/var/lib/gems/1.8/gems/highline-1.6.19/lib/highline/system_extensions.rb:210: warning: Insecure world writable dir /home/gabriele in PATH, mode 040777
/var/lib/gems/1.8/gems/commander-4.1.3/lib/commander/runner.rb:365:in `require_program': program version required (Commander::Runner::CommandError)
from /var/lib/gems/1.8/gems/commander-4.1.3/lib/commander/runner.rb:364:in `each'
from /var/lib/gems/1.8/gems/commander-4.1.3/lib/commander/runner.rb:364:in `require_program'
from /var/lib/gems/1.8/gems/commander-4.1.3/lib/commander/runner.rb:52:in `run!'
from /var/lib/gems/1.8/gems/commander-4.1.3/lib/commander/delegates.rb:7:in `run!'
from /var/lib/gems/1.8/gems/commander-4.1.3/lib/commander/import.rb:10
from /usr/local/bin/jekyll:19
/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- json (LoadError)
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.8/gems/jekyll-1.3.0/bin/../lib/jekyll/filters.rb:2
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.8/gems/jekyll-1.3.0/bin/../lib/jekyll.rb:43
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from /var/lib/gems/1.8/gems/jekyll-1.3.0/bin/jekyll:7
from /usr/local/bin/jekyll:19:in `load'
from /usr/local/bin/jekyll:19
after I've installed jekyll on Ubuntu 12.04 with
sudo apt-get install ruby1.9.1-dev && sudo gem install jekyll
This is my gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.15
- RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/1.8
- /home/gabriele/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
How can i solve it?
Running gem install json should fix the LoadError.
Commander throws that program version required error whenever there is a problem loading in the executable (in this case, bin/jekyll). As 1.8.7 can't load an internal json library (introduced in 1.9), you'll need to install the gem.

cannot load such file -- mechanize.rb (LoadError) on OSX 10.6

I have a simple script:
require 'rubygems'
require 'mechanize'
p 'Success!'
When I run the script, I get:
/Users/.../.rvm/rubies/ruby-1.9.3-p385/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mechanize.rb (LoadError)
from /Users/.../.rvm/rubies/ruby-1.9.3-p385/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from test.rb:2:in `<main>'
In desperation I installed RVM and updated ruby from system 1.8.7. Yet I am still getting the same error as before I installed rvm. I am now running:
mute:nfg ..$ ruby -v
ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-darwin10.8.0]
irb reports the same:
1.9.3p385 :001 > require 'rubygems'
=> false
1.9.3p385 :002 > require 'mechanize'
LoadError: cannot load such file -- mechanize
from /Users/../.rvm/rubies/ruby-1.9.3-p385/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/../.rvm/rubies/ruby-1.9.3-p385/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from (irb):2
from /Users/../.rvm/rubies/ruby-1.9.3-p385/bin/irb:16:in `<main>'
I have re-installed mechanize, using sudo and without, several times from the project directory.
I have tried manually requiring the gem, along with its full path.
mute:nfg ..$ ruby -l ~/.gems/gems/mechanize-2.5.1/lib/mechanize.rb
/Users/../.rvm/rubies/ruby-1.9.3-p385/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mime/types (LoadError)
from /Users/../.rvm/rubies/ruby-1.9.3-p385/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/../.gems/gems/mechanize-2.5.1/lib/mechanize.rb:4:in `<main>'
(I have tried installing mime-types, too.)
RVM lists the gem fine:
mute:nfg ..$ rvm all do gem list
*** LOCAL GEMS ***
...
libxml-ruby (2.3.3, 1.1.2)
mechanize (2.5.1)
mime-types (1.21, 1.19)
...
As does gem:
mute:nfg ..$ gem list
*** LOCAL GEMS ***
...
libxml-ruby (2.3.3, 1.1.2)
mechanize (2.5.1)
mime-types (1.21, 1.19)
...
Curiously, the $GEM_PATHs ~/.rvm/gems/ruby-1.9.3-p385, ~/.rvm/gems/ruby-1.9.3-p385#global and ~/.rvm/gems/ruby-1.9.3-p385#project appear mostly empty (two gems in the first, none in either of the last). However, the GUI JewelleryBox confirms that all three gemsets contain Mechanize.
EDIT: Here is the result of gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.25
- RUBY VERSION: 1.9.3 (2013-02-06 patchlevel 385) [x86_64-darwin10.8.0]
- INSTALLATION DIRECTORY: /Users/../.gems
- RUBY EXECUTABLE: /Users/../.rvm/rubies/ruby-1.9.3-p385/bin/ruby
- EXECUTABLE DIRECTORY: /Users/../.gems/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-10
- GEM PATHS:
- /Users/../.gems
- /Users/../.gem
- /usr/lib/ruby/gems/1.8
- /Library/Ruby/Gems/1.8
- /usr/bin
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org/", "http://gems.github.com"]
- "gemhome" => "/Users/../.gems"
- "gempath" => ["/Users/../.gem", "/usr/lib/ruby/gems/1.8", "/Library/Ruby/Gems/1.8", "/usr/bin"]
- REMOTE SOURCES:
- http://gems.rubyforge.org/
- http://gems.github.com
Can anyone help?
your environment is set to use custom paths for gems, this confuses rubygems as you install to places which are not available in PATH
run rvm get head and carefully read the outputs, it will warn you about entries in *gemrc that break rubygems / RVM

Ruby gems home on Windows

I installed ruby for windows and then rubygems but am getting the following error when trying to use rubygems to install bundler.
C:\Users\tgandrews\Ruby\rubygems-1.8.24>gem install bundler --verbose --debug
Exception `NameError' at C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:177 - uninitialized constant Gem::Commands::InstallCommand
Exception `Errno::ENOENT' at C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:54 - No such file or directory - Z:/
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory - Z:/
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:54:in `stat'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:54:in `initialize'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:43:in `new'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/spec_fetcher.rb:43:in `fetcher'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:110:in `find_gems_with_sources'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:228:in `find_spec_by_name_and_version'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:259:in `install'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/commands/install_command.rb:121:in `block in execute'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/commands/install_command.rb:115:in `each'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/commands/install_command.rb:115:in `execute'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/command.rb:278:in `invoke'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:147:in `process_args'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/command_manager.rb:117:in `run'
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:65:in `run'
C:/Ruby193/bin/gem:30:in `<main>'
My gem env returns the following
C:\Users\tgandrews\Ruby\rubygems-1.8.24>gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby193/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: C:/Ruby193/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby193/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- C:/Ruby193/lib/ruby/gems/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
This might be caused by a network drive and incorrect configuration of environment variables like HOME, HOMEDRIVE and/or HOMEPATH
Please see the following section of RubyInstaller troubleshooting section:
https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#wiki-network_drive_home

Installing The ruby-gmail rubygem on Mac OS Snow Leopard

I'm working off these instructions: http://github.com/dcparker/ruby-gmail
From the home directory I do a standard install and good stuff happens:
Johnny-Goodmans-MacBook-Pro:gmail johnnygoodman$ sudo gem install ruby-gmail
Successfully installed ruby-gmail-0.2.1
1 gem installed
Installing ri documentation for ruby-gmail-0.2.1...
Installing RDoc documentation for ruby-gmail-0.2.1...
I head over to my ~/www dir where I run scripts that include other rubygems successfully and create a gmail directory. I create a script that includes rubygems and gmail, but does nothing else:
Johnny-Goodmans-MacBook-Pro:gmail johnnygoodman$ pwd
/Users/johnnygoodman/www/gmail
Johnny-Goodmans-MacBook-Pro:gmail johnnygoodman$ ls
test-send.rb
Johnny-Goodmans-MacBook-Pro:gmail johnnygoodman$ cat test-send.rb
require 'rubygems'
require 'gmail'
I run this script and the errors begin:
Johnny-Goodmans-MacBook-Pro:gmail johnnygoodman$ ruby test-send.rb
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- mime/message (LoadError)
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Ruby/Gems/1.8/gems/ruby-gmail-0.2.1/lib/gmail/message.rb:1
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
from /Library/Ruby/Gems/1.8/gems/ruby-gmail-0.2.1/lib/gmail.rb:168
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
from test-send.rb:2
Johnny-Goodmans-MacBook-Pro:gmail johnnygoodman$
Here's my gem env:
Johnny-Goodmans-MacBook-Pro:gmail johnnygoodman$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2009-06-08 patchlevel 173) [universal-darwin10.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-10
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/johnnygoodman/.gem/ruby/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://rubygems.org/", "http://gems.github.com"]
- REMOTE SOURCES:
- http://rubygems.org/
- http://gems.github.com
The path that the errors give when I run the script is not the same as the GEM PATHS given in the env output. However, I don't know how to make them match or if that's the significant thing here.
sudo gem install mime
the problem with the Asif solution is than mime/message is necessary for atach any file to the mail, if you comment this line u are unable do it

Resources