Can't find mechanize gem error require - ruby

So i've been using the mechanize gem fine on my OSX machine but now when i'm trying to use it on my Win10 machine i've run into some issues. Basically it can't find the mechanize gem for some reason. C:/Ruby21-x64/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- mechanize (LoadError)

Are you able to use other gems on your win10 machine without error?
It looks like the error is with nokogiri not with mechanize. Which version of Nokogiri do you have installed?
I would try updating your gems with gem update --system

Try to install it:
gem install nokogiri

you should run the desktop app "start command prompt with ruby" or do win+r (for run on windows) and type:
C:\Windows\System32\cmd.exe /E:ON /K C:\Ruby22-x64\bin\setrbvars.bat
once you are in there, run your command: gem install nokogiri

apt-get install ruby2.2-dev should work :-)

Related

Ruby - Watir - PhantomJS

I'm on debian. I have ruby set up with bundle. I do
sudo gem install watir-webdriver
sudo gem install phantomjs
Then I add both to my Gemfile. Then I do bundle install. Then I run ruby code
Watir::Browser.new(:phantomjs)
and get this error:
/var/lib/gems/2.1.0/gems/selenium-webdriver-2.52.0/lib/selenium/webdriver/phantomjs/service.rb:38:in `executable_path': Unable to find phantomjs executable. (Selenium::WebDriver::Error::WebDriverError)
How do I make this work? Thanks!
you don't have phantomjs installed correctly (or at all), so when your program tries to open phantomjs, it cant find it.
try this
http://www.netdip.com/install-phantomjs-1422766836/
You may install phantomjs as a gem.

ERROR: Error installing json: ERROR: Failed to build gem native extension

I am trying to install gem json and getting error for json.
I'm running:
Windows 8.1 (64 bit)
Ruby: ruby 1.9.3p545 (2014-02-24) [i386-mingw32]
gem: 1.8.2
D:\GIT\calabash>gem install json -v '1.8.3'
Building native extensions. This could take a while...
The system cannot find the path specified.
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.3 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
D:\GIT\calabash>
Its a late response, but may it helps someone else. to install json '1.8.3' it requires packages 'libgmp3-dev'.
Use following steps:
sudo apt-get install libgmp3-dev
gem install json -v '1.8.3'
For anyone who has this issue on Sierra, I solved the problem through this thread: https://teamtreehouse.com/community/installing-ruby-on-mac-got-error
Coles notes version is that after updating to most recent version of XCode, I had to accept the terms for the XCode command line tools. See them/agree to them by running:
gcc --version
After I did that, everything installed as expected.
To help you here are some steps to follow in order to install your gem locally:
Download json-1.8.3.
Place the downloaded gem into a folder called gems
Open the Ruby cmd console (click on start button, select Ruby then select "Start command prompt with Ruby")
cd to the gems folder. If the path to the folder is C:\Desktop\gems, write the command: cd C:\Desktop\gems then click "Enter".
To install the gem run the following command:
gem install --local json-1.8.3.gem
I tried it and it worked for me, hopefully it will work for you.
Result:
Second way:
Include the whole path of the gem in the command:
gem install --local C:\Users\kedarl\Desktop\T\json-1.8.2.gem
For me here is the result. (This time with the json-1.8.2.gem):
I've solved this by installing Command Line Tools Xcode of the version I have. I hope this helps someone else.
If you installed Rails through RailsInstaller, try this -
https://gist.github.com/luislavena/f064211759ee0f806c88
It's a pretty common bug for RailsInstaller currently.

Installing a gem hangs with no output on Windows

So, I installed Rails Installer on my machine (Windows). I just tried to install a gem (nokogiri), but to no avail. In the cmd window, running gem install nokogiri just hangs, provides no status and nothing happens. Any idea what I am doing wrong?
To know what actually is happening try
gem install nokogiri -V

Cannot install Ruby Gems in Windows 7

I have successfully installed Ruby Gems on my Mac many times. I need to configure a Windows 7 Enterprise virtual machine with Compass, Sass and Suzy.
I downloaded an installed Ruby on the Windows machine with the installer, 1.9.3. I ran gem update --system which updated Rubygems to 1.8.4.
I was able to install Sass 3.2 by running gem install sass
However, if I run gem install compass or gem install susy I get an error:
Error while excecuting gem .. (ArgumentError) marshall data too short
Any ideas? At this point, I can't install those gems.
The alternative solution..: Download gem compass from here to your ruby root folder. Then try again
gem install compass
It should install this time..Good luck
Had same issue, updating rubygems system solved it. Just use the following command
gem update --system
For those finding this question, many great tips here. Using them, I found this solution to work:
At the N: prompt in "start command line with ruby environment", I used the command rmdir /S .gem which deleted all gems. I then installed them again with gem install as directed on their respective host web pages. Hope this helps someone.

Installing new gems

Hi I am looking to install the win32-service gem in Ruby for Windows, I have tried using the "gem install" command but it doesn't seem to know where to find my gem ;(
I downloaded the gem itself which came with a load of folders but no install instructions.
Is there anyway I can manually install the gem or point IRB in the right direction?
run this command to install gem file manually.
gem install [your gem file]

Resources