uninitialized constant Scrubyt::Navigation::Mechanize::WWW (NameError) - ruby-on-rails

I am using the Scrubyt gem, and when I use it, I get this error:
/home/bitnami/.rvm/gems/ruby-1.8.7-p352/gems/scrubyt-0.4.06/lib/scrubyt/core/navigation/agents/mechanize.rb:17:in `included': uninitialized constant Scrubyt::Navigation::Mechanize::WWW (NameError)
I have the following gems installed
*** LOCAL GEMS ***
builder (3.0.0)
commonwatir (2.0.1)
firewatir (1.9.3)
hoe (2.12.2)
hpricot (0.8.4)
mechanize (2.0.1)
net-http-digest_auth (1.1.1)
net-http-persistent (1.9)
nokogiri (1.5.0)
rake (0.9.2)
s4t-utils (1.0.4)
scrubyt (0.4.06)
user-choices (1.1.6.1)
webrobots (0.0.11)
xml-simple (1.1.0)
Any idea what could be wrong here?

I was having the same problem. I resolved this issue installing the exact versions of hpricot and Mechanize
sudo gem install hpricot -v 0.5
sudo gem install mechanize -v 0.6.3
then
sudo gem install scrubyt
but first I uninstalled previous gem versions with
sudo gem uninstall hpricot
sudo gem uninstall mechanize

Related

Install CocoaPods on an old Mac

I'm using the Unity 5.2.4f game development engine and I have installed Ruby 1.9.3 on my old Mac with a Mac OS X v10.7.5 (Lion) system on it.
When I open a Unity project for the first time, there is an installation attempt which is failing and I don't know how to solve this, after trying for a few days. Here is the error I get:
IOS RESOLVER
Failed to install Cocoapods for the current user.
It will not be possible to install Cocoapods in the generated Xcode project which will result in link errors when building your application.
For more information see:
https://guides.cocoapods.org/using/getting-started.html
'gem install activesupport -v 4.2.6 --user-install' failed with code (1):
WARNING: You don't have /Users/DAN26/.gem/ruby/1.8/bin in your PATH,
gem executables will not run.
ERROR: Error installing activesupport:
i18n requires Ruby version >= 1.9.3.
So I go to the Terminal and do the following:
export PATH="/Users/DAN26/.gem/ruby/1.9.3/bin:$PATH"
No change. So I do this:
export PATH="/Users/DAN26/.gem/ruby/1.8/bin:$PATH"
Still get the same message...
Enter
$PATH
Result:
-bash: /usr/local/opt/openssl/bin:/Users/DAN26/.rbenv/bin:/Users/DAN26/.rbenv/shims:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/DAN26/.rvm/bin: No such file or directory
I have installed lower versions of activesupport 4.2.5 and cocoapods 0.34.4 but no change (I have installed them because any other versions require Ruby 2.0.0+ which I fail to install)
Also if I enter in the Terminal:
gem list
I get this:
*** LOCAL GEMS ***
activesupport (4.2.9, 4.2.6, 4.2.5, 3.2.22.5)
bigdecimal (1.1.0)
claide (0.7.0)
cocoapods (0.34.4)
cocoapods-core (0.34.4)
cocoapods-downloader (0.7.2)
cocoapods-plugins (0.3.2)
cocoapods-trunk (0.3.1)
cocoapods-try (0.4.5)
colored (1.2)
escape (0.0.4)
fuzzy_match (2.0.4)
i18n (0.8.6)
io-console (0.3)
json (1.8.6, 1.5.5)
json_pure (1.8.6)
minitest (5.10.3, 2.5.1)
multi_json (1.12.1)
nap (1.1.0, 0.8.0)
netrc (0.7.8)
open4 (1.3.4)
rake (0.9.2.2)
rdoc (3.9.5)
thread_safe (0.3.6)
tzinfo (1.2.3)
xcodeproj (0.19.4)
I don't have any understanding on Mac. All I did above was by tutorials.
You can use sudo gem install cocoapods for installing CocoaPods in an old mac. It will be asking for the administrator password.
Based on the upcoming error, do the below steps:
sudo gem install activesupport -v 4.2.6
sudo gem install cocoapods
It can be possible you have to check activesupport version with this link.

Why "bundle install" try to install outdated version of gems?

I have different gemsets
> rvm gemset list
gemsets for ruby-2.0.0-p247 (found in /Users/kai/.rvm/gems/ruby-2.0.0-p247)
=> (default)
global
rails4
> rvm gemset use rails4
Using ruby-2.0.0-p247 with gemset rails4
> rails -v
/Users/kai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'railties' (>= 0) among 43 total gem(s) (Gem::LoadError)
from /Users/kai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /Users/kai/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/bin/rails:22:in `<main>'
from /Users/kai/.rvm/gems/ruby-2.0.0-p247#rails4/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/kai/.rvm/gems/ruby-2.0.0-p247#rails4/bin/ruby_noexec_wrapper:14:in `<main>'
and when I'm doing:
> bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.1.0)
Installing i18n (0.6.4)
Installing multi_json (1.7.9)
Installing activesupport (3.2.7)
Installing builder (3.0.4)
Installing activemodel (3.2.7)
Installing erubis (2.7.0)
Installing journey (1.0.4)
Installing rack (1.4.5)
Installing rack-cache (1.2)
Installing rack-test (0.6.2)
Installing hike (1.2.3)
Installing tilt (1.4.1)
Installing sprockets (2.1.3)
Installing actionpack (3.2.7)
Installing mime-types (1.23)
Installing polyglot (0.3.3)
Installing treetop (1.4.14)
Installing mail (2.4.4)
Installing actionmailer (3.2.7)
Installing arel (3.0.2)
Installing tzinfo (0.3.37)
Installing activerecord (3.2.7)
Installing activeresource (3.2.7)
Installing coffee-script-source (1.6.3)
Installing execjs (1.4.0)
Installing coffee-script (2.2.0)
Installing rack-ssl (1.3.3)
Installing json (1.8.0)
Installing rdoc (3.12.2)
Installing thor (0.18.1)
Installing railties (3.2.7)
Installing coffee-rails (3.2.2)
Installing jquery-rails (3.0.4)
Using bundler (1.3.5)
Installing rails (3.2.7)
Installing sass (3.2.10)
Installing sass-rails (3.2.6)
Installing sqlite3 (1.3.7)
Installing uglifier (2.1.2)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:
<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
But I have ruby 2.0! Why it doesn't install rails 4.0 and activesupport 4.0?
bundler installs gems basing on two files:
Gemfile.lock strict versions saved during previous installation,
Gemfile loose version declaration from user.
when you generate rails project first Gemfile is generated with something like this:
gem 'rails', '~> 3.2'
after the file is generated bundle install is ran which generates Gemfile.lock in which strict versions of gems are recorded, from now on any succeeding call to bundle install will install only the versions saved in Gemfile.lock.
To update gems to newer versions:
check Gemfile for any version restrictions - that might prevent installing the versions you would like to get
run bundle update <gem_name> to update only this single gem and what is require for it - but minimalizing scope of the changes to the smallest possible set of changes.
run bundle update to update all gems to latest versions allowed in Gemfile
bundle install or in short bundle does not install the latest gem unless you have left out the version in your Gemfile. e.g.
gem 'rails'
But usually this is not the case, we specify versions to prevent application from "crashing" when some gems are updated and we unknowingly run bundle update, or for that matter move application to say test or production servers. Usually when adding a gem to Gemfile, we do:
gem 'rails', '~> 3.2.7'
Note the leading ~> in the version number. This says: use rails gem between versions 3.2.7 and less than 3.3.0.
In order for your bundle command to grab rails 4.0, you need to change that line to read either one of the following:
gem 'rails', '>= 3.2.7'
or
gem 'rails', '4.0.0'
If you use gem 'rails', '>= 3.2.7' then your rails application will use the latest gem available in your system. Note that 3.2.7 is just an example I'm using here. If you use gem 'rails', '4.0.0' then your rails application will use rails version 4.0.0.
Please note that this change might break your existing rails 3.2 application.

gem 1.8.23 install rails 3.2.8 failed, Unable to resolve dependencies

I'm trying to install Rails 3.2.8 to a linux box without internet connection. I've manually downloaded all the related gem packages and copied them to the linux box. When I try to install some of those packages, I got error. e.g., :
[jw#web gems]$ sudo /usr/local/bin/gem install --local ./activemodel-3.2.8.gem
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: activemodel requires builder (~> 3.0.0)
The strange thing is that some packages can be installed this way. e.g., the builder has already been installed. Please note that all the dependencies required are there.
How come the dependencies is unable to resolve ?
My environment:
Ruby: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
Rubygem: 1.8.23
My installed gems:
[jw07#web gems]$ gem list
*** LOCAL GEMS ***
activesupport (3.2.8)
arel (3.0.2)
bigdecimal (1.1.0)
builder (3.1.3)
bundler (1.2.0)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.1)
io-console (0.3)
journey (1.0.4)
json (1.7.5)
mail (2.4.4)
mime-types (1.19)
minitest (2.5.1)
multi_json (1.3.6)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rake (0.9.2.2)
rdoc (3.9.4)
sprockets (2.5.0)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)
It does not look like Rubygems version is a problem.
You see rails requires gem builder ~> 3.0.0, but you have 3.1.3 which does not match (~> means it will match 3.0.x, but not 3.1.x). You have to install builder 3.0.3.
Another possibility could be there is another gem in your Gemfile that requires builder 3.1.x, causing a conflict. It would be helpful if you provided your Gemfile.
Try to upgrade to the latest RubyGems:
gem update --system
And install rails with dependencies:
gem install rails --include-dependencies

"bundle install" fails even though bundler-1.1.3 is installed

I'm trying to run "bundle install" and it seems to have an issue with finding the appropriate gemfile even though I installed the gem bundler. I'm not sure what to do from here. When I run "bundle install" I get this:
C:\Users\User1\Sites\simple_cms>bundle install
Fetching gem metadata from http://rubygems.org/.........
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) x86-mingw32 depends on
bundler (~> 1.0.0) x86-mingw32
Current Bundler version:
bundler (1.1.3)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
So then I install the bundler gem which appears to install just fine.
C:\Users\User1\Sites\simple_cms>gem install bundler
Successfully installed bundler-1.1.3
1 gem installed
Installing ri documentation for bundler-1.1.3...
Installing RDoc documentation for bundler-1.1.3...
But even though the install for the bundler gem succeeded "bundle install" still fails:
C:\Users\User1\Sites\simple_cms>bundle install
Fetching gem metadata from http://rubygems.org/.........
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.0) x86-mingw32 depends on
bundler (~> 1.0.0) x86-mingw32
Current Bundler version:
bundler (1.1.3)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
When I run "gem list" the bundler is definitely there:
C:\Users\User1\Sites\simple_cms>gem list
*** LOCAL GEMS ***
actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.3)
arel (3.0.2)
bigdecimal (1.1.0)
builder (3.0.0)
bundler (1.1.3)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.1)
erubis (2.7.0)
execjs (1.3.1)
hike (1.2.1)
i18n (0.6.0)
io-console (0.3)
journey (1.0.3)
jquery-rails (2.0.2)
json (1.7.0, 1.5.4)
mail (2.4.4)
mime-types (1.18)
minitest (2.5.1)
multi_json (1.3.4)
mysql2 (0.3.11 x86-mingw32)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.3)
railties (3.2.3)
rake (0.9.2.2)
rdoc (3.12, 3.9.4)
rubygems-update (1.8.24)
sass (3.1.16)
sass-rails (3.2.5)
sprockets (2.1.3)
sqlite3 (1.3.6 x86-mingw32)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)
uglifier (1.2.4)
C:\Users\User1\Sites\simple_cms>
Try to remove your Gemfile.lock. Then run bundle check and see the output. It may ask you to run bundle install again.
It looks to me like your version of Rails (3.0.0) requires Bundler 1.0.0 -- you have a newer version.
You can install a specific version through gem install like this:
gem install bundler -v 1.0.0
I suggest you don't copy and paste whole projects.
First of all learn to use rvm or rbenv so you don't encounter conflicts with ruby versions and gems.
if your tutorial uses rails 3.0, you can put in something like
gem 'rails', '3.0.0'
in your Gemfile.
I suggest you install the latest rails version though and learn that.

Rails: Could not find railties

➜ ~ rvm -v
rvm 1.10.2 by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.beginrescueend.com/]
➜ ~ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
➜ ~ rails -v
/Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1208:in `gem'
from /Users/hb/.rvm/gems/ruby-1.9.3-p0/bin/rails:18:in `<main>'
➜ ~
I installed a clean installation of ruby just now, and rails, I removed all my previous gems, and I still keep getting this error. Any ideas ? And yes, I had this error before, and this is what I did
A little more info:
➜ ~ gem list
*** LOCAL GEMS ***
actionmailer (3.2.1)
actionpack (3.2.1)
activemodel (3.2.1)
activerecord (3.2.1)
activeresource (3.2.1)
activesupport (3.2.1)
arel (3.0.0)
builder (3.0.0)
bundler (1.0.22 ruby)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.1)
json (1.6.5)
mail (2.4.1)
mime-types (1.17.2)
multi_json (1.0.4)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.1)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.1)
railties (3.2.1)
rake (0.9.2.2, 0.9.2)
rdoc (3.12)
sprockets (2.3.0, 2.1.2)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
➜ ~ gem install rails
Successfully installed rails-3.2.1
1 gem installed
Installing ri documentation for rails-3.2.1...
Installing RDoc documentation for rails-3.2.1...
➜ ~ rails -v
/Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /Users/hb/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1208:in `gem'
from /Users/hb/.rvm/gems/ruby-1.9.3-p0/bin/rails:18:in `<main>'
➜ ~
It means your Rails installation is corrupted or incomplete. If you list your gems, chances are you won't find railties
$ gem list
Run the command
$ gem install rails
again. It will download and install missing dependencies, including railties.
I ran into the same problem and, in my case, it turned out to be because I had installed using sudo - it does not necessarily make rails available to ordinary users. Try running just gem install rails if you previously ran sudo gem install rails.
Worked for me
rvm reinstall 1.9.3
then
gem install rails
I ran into this same issue. If you're using RVM it's possible you switched to the wrong Ruby version which causes a gem load error if the directory uses a different version than the one you are currently set to use.
To fix, type rvm use -yourrubyversion in the app's directory in terminal. For example, if your app is set up to use ruby 1.9.3 type rvm use -1.9.3.
RVM works by separating your gems by ruby version by app, so if you switch to a different ruby version RVM will separate previously used and installed gems from the different ruby version, which is why you may be seeing tho issue.
rvm implode was the answer. Something probably went wrong before, now everything works after a rvm reinstall.
Maybe you installed two or more version of rails and railties.
gem uninstall railties
gem uninstall rails
then reinstall.
I got the same error when I installed ruby 1.9.3p194
and then I reinstalled ruby and rails
Simone's answer is great. However, if you already have your Rails gem in your Gemfile, just try to use bundle exec instead:
bundle exec rails c
And that should suffice. If not, then add
bundle install
before the mentioned command.
I also had this issue after I installed ZSH (Wanted to mess with it's templates.)
Ran
brew update
which did find some updates I wasn't missing before, but in the end
gem install rails
suddenly completely re-installing the rail/ties system. Unsure why ZSH removed it.
Uninstalling ruby, and railsinstaller and then installing railsinstaller again worked great for me!
I did 'gem install rails' on my system (ubuntu) and it installed the missing gems approx 28 of them then i did 'gem list' to check and it was all there.

Resources