Newbie alert...
Trying to fix a problem with my rails webrick server (i.e. get it started), I used an old Stackoverflow answer old answer and did the following command
sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
However, I forgot to change the version numbers. For example, my mysql is 0.3.6 (as opposed to the 0.2.6 in the command), and it is also libmysqlclient.18 instead of .16.
Now when I try to start rails server it says
Could not find gem 'mysql2 (~> 0.2.6)' in any of the gem sources listed in your Gemfile.
I tried to rerun this command with the updated versions but it didn't change anything...Indeed, it doesn't even ask me for my root password... Any ideas how I can reverse this problem?
Update -- this is the list of gems produced when I do gem list. The first person who answered this question suggested (in his comments) that I uninstall mysql .0.2.6 but that gem was never installed. When I did the name_tool command described above, it told the system to look for mysql 0.2.6, when I should have told it to look for mysql2-0.3.6.
abstract (1.0.0)
actionmailer (3.0.9, 3.0.7)
actionpack (3.0.9, 3.0.7)
activemodel (3.0.9, 3.0.7)
activerecord (3.0.9, 3.0.7)
activeresource (3.0.9, 3.0.7)
activesupport (3.0.9, 3.0.7)
arel (2.0.10)
builder (2.1.2)
bundler (1.0.14)
erubis (2.6.6)
i18n (0.5.0)
mail (2.2.19)
mime-types (1.16)
mysql2 (0.3.6)
polyglot (0.3.1)
rack (1.2.3)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.9, 3.0.7)
railties (3.0.9, 3.0.7)
rake (0.9.1)
rdoc (3.8)
rubygems-update (1.8.5)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.27)
Update --after following instructions in Eric Hu's answer, I got this result when I ran rails server from my project folder
2011-07-26 01:49:17 rails s
/Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle
Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle
from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2.rb:9
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:68:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:66:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:66:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:55:in `each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.14/lib/bundler.rb:120:in `require'
from /Users/michaelmitchell/Sites/simple_cms/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:28:in `require'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:28
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:27:in `tap'
from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:27
from script/rails:6:in `require'
from script/rails:6
Update -- I did bundle list as Eric suggested in his comment
Gems included by the bundle:
* abstract (1.0.0)
* actionmailer (3.0.9)
* actionpack (3.0.9)
* activemodel (3.0.9)
* activerecord (3.0.9)
* activeresource (3.0.9)
* activesupport (3.0.9)
* arel (2.0.10)
* builder (2.1.2)
* bundler (1.0.14)
* erubis (2.6.6)
* i18n (0.5.0)
* mail (2.2.19)
* mime-types (1.16)
* mysql2 (0.2.11)
* polyglot (0.3.1)
* rack (1.2.3)
* rack-mount (0.6.14)
* rack-test (0.5.7)
* rails (3.0.9)
* railties (3.0.9)
* rake (0.9.2)
* rdoc (3.8)
* thor (0.14.6)
* treetop (1.4.9)
* tzinfo (0.3.29)
I believe you're experiencing confusion over using bundler and RubyGems. When you gem install <gemname>, you're using a RubyGems commands to install the newest version of <gemname>.
Rails projects come with a gem called bundler, which also manages gems. Bundler builds a separate copy of gems for each Rails project that you create a Gemfile for. If you don't recall making a Gemfile, that's because it's one of the files that rails new <projectname> will generate for you.
Most likely, you haven't run a bundle install. Before you do, go to the folder for your current Rails project and open up Gemfile, just so you know what's going on. I'm willing to bet there's a line in there like this: gem 'mysql2', '~> 0.2.6'
To install the right version, go to your project folder in the command line. Type bundle install. Give it a minute and that should be it--try running rails s again.
If this seems confusing and unnecessary, just remember that when someone updates a gem, they could make it change in ways that would break your program. Bundler does you a service by ensuring that your program is running with specific versions of the gems needed (in this case, mysql2-0.2.6 instead of mysql2-0.3.6).
Clean out that gem and reinstall it.
Alternatively, RVM + Mac Homebrew for the MySQL installation works wonders.
Related
I am using OS X Mountain Lion. I've installed Ruby 2.0.0-p247. I've installed the Rubygems. I've installed Ruby 4.0.0. Everything was successfully installed (or seemed to be).
But when I try to verify the install of Rails by typing:
rails --version
I get:
/Users/dnassler/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:298:in `to_specs': Could not find 'thread_safe' (~> 0.1) - did find: [thread_safe-0.1.3-java] (Gem::LoadError)
from /Users/dnassler/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1265:in `block in activate_dependencies'
from /Users/dnassler/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1254:in `each'
from /Users/dnassler/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1254:in `activate_dependencies'
from /Users/dnassler/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1236:in `activate'
from /Users/dnassler/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1268:in `block in activate_dependencies'
from /Users/dnassler/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1254:in `each'
from /Users/dnassler/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1254:in `activate_dependencies'
from /Users/dnassler/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb:1236:in `activate'
from /Users/dnassler/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:48:in `gem'
from /Users/dnassler/.rvm/gems/ruby-2.0.0-p247#global/bin/rails:22:in `<main>'
from /Users/dnassler/.rvm/gems/ruby-2.0.0-p247#global/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/dnassler/.rvm/gems/ruby-2.0.0-p247#global/bin/ruby_noexec_wrapper:14:in `<main>'
And if I type "gem list" this is what I have:
derek-nasslers-mac-mini:~ dnassler$ gem list
*** LOCAL GEMS ***
actionmailer (4.0.0)
actionpack (4.0.0)
activemodel (4.0.0)
activerecord (4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.0)
arel (4.0.0)
atomic (1.1.13 java)
builder (3.1.4)
bundler (1.3.5)
bundler-unload (1.0.1)
erubis (2.7.0)
hike (1.2.3)
i18n (0.6.5)
mail (2.5.4)
mime-types (1.25)
minitest (4.7.5)
multi_json (1.8.0)
polyglot (0.3.3)
rack (1.5.2)
rack-test (0.6.2)
rails (4.0.0)
railties (4.0.0)
rake (10.1.0)
rubygems-bundler (1.2.2)
rvm (1.11.3.8)
sprockets (2.10.0)
sprockets-rails (2.0.0)
thor (0.18.1)
thread_safe (0.1.3 java)
tilt (1.4.1)
treetop (1.4.15)
tzinfo (0.3.37)
Maybe the problem has something to do with the fact that my thread_safe seems to be java?
UPDATE: I've fixed the issue with the thread_safe complaint by trying:
gem install thread_safe -v 0.1
then when I try typing:
rails --version
...I get almost the same error as before but this time it couldn't find 'atomic' and that seems to be another gem that is a java version as well. However I cannot seem to get the ruby version of the gem because the ruby version is the same as the java version 1.1.13. I know this because I tried doing a gem search for atomic and I see:
gem search atomic
derek-nasslers-mac-mini:~ dnassler$ gem search atomic
*** REMOTE GEMS ***
atomic (1.1.13 ruby java)
atomic-parsley-ruby (0.0.3)
atomic_mem_cache_store (0.0.3)
atomics_resource (0.0.2)
AtomicTV (1.0.2)
datomic-client (0.4.1)
mongoid_atomic (0.1.0)
mongoid_atomic_votes (0.1)
rails_atomic_increment (0.2)
So I think that I could solve the issue if only I knew how to install the gem called "atomic" that is version 1.1.13 ruby. So how can I specify to install version 1.1.13 (the ruby version)? Simply doing "gem install atomic -v 1.1.13" does nothing because I already have version 1.1.13 (but it is the java version). I cannot yet figure out how to specify that I want the ruby version...
Anyone know how to specify to install the ruby version?
Do you have rubygems 2.1.0 installed? Might be a rubygems 2.1.0 bug
Try this:
sudo gem update --system 2.0.8
Then run the rails install again (after having uninstalled the -java gems of course)
I had the same issue. In the terminal do
gem uninstall thread_safe 0.1.3 java
gem install thread_safe
gem uninstall atomic 1.1.13 java
gem install atomic
And that should do it.
In Ruby on Rails, I am trying to install it on my Windows machine following the step-by-step instructions indicated in http://railsinstaller.org/windows
On step 7, it says we should type in this command:
$ rails g controller welcome index
And so I do:
PS C:\Sites\railsinstaller_demo> rails g controller welcome index
And I get this error:
C:/Program Files/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:926:in
`report_activate_error': Could not find RubyGem railties (>= 0) (Gem::LoadError)
from C:/Program Files/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:244:in
`activate_dep'
from C:/Program Files/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:236:in `activate'
from C:/Program Files/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:1307:in `gem'
from C:/RailsInstaller/Ruby1.9.3/bin/rails:18:in `<main>'
I have googled this error and read that the solution was to install de DevKit and so I did, but the problem remains.
What causes these errors?
Edit:
This is what appears when I run gem list:
PS C:\Sites\railsinstaller_demo> gem list
*** LOCAL GEMS ***
actionmailer (3.2.9)
actionpack (3.2.9)
activemodel (3.2.9)
activerecord (3.2.9)
activeresource (3.2.9)
activesupport (3.2.9)
arel (3.0.2)
builder (3.0.4)
erubis (2.7.0)
foreman (0.60.2)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
mail (2.4.4)
mime-types (1.19)
minitest (1.6.0)
multi_json (1.5.0)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack-ssl (1.3.2)
rack-test (0.6.2)
rake (0.8.7)
rdoc (2.5.8)
rest-client (1.6.7)
sequel (3.20.0)
sinatra (1.0)
sprockets (2.2.2)
taps (0.3.24)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.12)
tzinfo (0.3.35)
As suggested by #EricLeschinski I tried tu run "gem install rails" but this error appeared:
PS C:\Sites\railsinstaller_demo> gem install rails
ERROR: Error installing rails:
The 'json' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
Final edit:
In the end, I don't how bad I messed up my initial installation, but I found this Youtube video http://www.youtube.com/watch?v=WUdDdiu8kBs which turned out to be the clearest way to install everything that I needed and had no problem at all following her instructions.
Could not find RubyGem railties
This error is due to the difference between the rails version you are using and the one defined in the Gemfile.
Try rails -v to check the rails version.
Reference : https://www.railstutorial.org/book/toy_app
Regarding Ruby on rails in windows 7. after installing the railsinstaller, I am facing lot of issue and not sure what the cause is?
PS: I posted this question on stack-overflow, somewhere else while looking for answer of similar issue, where a gentleman suggest me to put my question on separate thread. And here it goes.
The windows 7 is behind proxy and websense. I run all applications as administrator. I wonder if I left any site/blog for the issues I am facing. Though it is my first question here on ROR in stack-overflow after I exhausted options of reading and searching to resolve it.
I am even not able to do the
$ gem install rubygems-update
though I the path is correct and showing
c:\>gem sources
display
http://rubygems.org.
as the only source.
I am still getting the below error for the even simple database creation. That was given in root directory of sample rails project namely SampleROR.
Any help please.
$ rake db:create
The i18n gem is not available. Please add it to your Gemfile and run bundle install
rake aborted!
cannot load such file -- i18n
c:/RailsInstaller/DevKit/home/anil-ku/SampleROR/config/application.rb:3:in `require'
c:/RailsInstaller/DevKit/home/anil-ku/SampleROR/config/application.rb:3:in `<top (required)>'
c:/RailsInstaller/DevKit/home/anil-ku/SampleROR/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
Note that I am not able to do
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem update --system
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format
with latest version of rails, installed using railsinstaller one click for windows.
I did the bundle install after this, that run successfully but the issue didn't disappear.
anil-ku#hostname ~/SampleROR
$ bundle install
Using rake (10.0.2)
**Using i18n (0.6.1)**
Using multi_json (1.4.0)
Using activesupport (3.2.1)
Using builder (3.0.4)
Using activemodel (3.2.1)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.3)
Using actionpack (3.2.1)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.4.4)
Using actionmailer (3.2.1)
Using arel (3.0.2)
Using tzinfo (0.3.35)
Using activerecord (3.2.1)
Using activeresource (3.2.1)
Using bundler (1.0.22)
Using coffee-script-source (1.4.0)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.5)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.1)
Using coffee-rails (3.2.2)
Using jquery-rails (2.1.4)
Using rails (3.2.1)
Using sass (3.2.3)
Using sass-rails (3.2.5)
Using sqlite3 (1.3.6)
Using uglifier (1.3.0)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem
is installed.
anil-ku#DS-7071BC8FD6C4 ~/SampleROR
**$ bundle show i18n**
c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/i18n-0.6.1
when I list
$gem list -local
actionmailer (3.2.1)
actionpack (3.2.1)
activemodel (3.2.9, 3.2.1)
activerecord (3.2.1)
activerecord-sqlserver-adapter (3.2.1)
activeresource (3.2.1)
activesupport (3.2.9, 3.2.1)
archive-tar-minitar (0.5.2)
arel (3.0.2)
bigdecimal (1.1.0)
builder (3.0.4, 3.0.0)
bundler (1.0.22)
cgi_multipart_eof_fix (2.5.0)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.4.0, 1.2.0)
columnize (0.3.6)
daemons (1.1.9)
debugger-linecache (1.1.2)
debugger-ruby_core_source (1.1.5)
deprecated (3.0.1, 2.0.1)
erubis (2.7.0)
execjs (1.4.0, 1.3.0)
fastthread (1.0.7)
gem_plugin (0.2.3)
hike (1.2.1)
hoe (3.3.1)
**i18n (0.6.1, 0.6.0)**
io-console (0.3)
journey (1.0.4, 1.0.2)
jquery-rails (2.1.4)
json (1.7.5, 1.5.4)
mail (2.4.4, 2.4.1)
mime-types (1.19, 1.17.2)
minitest (4.3.3, 2.5.1)
multi_json (1.4.0, 1.3.7, 1.1.0)
mysql2 (0.3.11)
permutation (0.1.8)
pg (0.13.1 x86-mingw32)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2, 1.1)
rack-ssl (1.3.2)
rack-test (0.6.2, 0.6.1)
rails (3.2.1)
railties (3.2.1)
rake (10.0.2, 0.9.2.2)
rake-compiler (0.8.1)
rb-readline (0.4.2)
rbx-require-relative (0.0.9)
rdoc (3.12, 3.9.4)
ruby_core_source (0.1.5)
rubyzip (0.9.6.1)
sass (3.2.3)
sass-rails (3.2.5)
sdoc (0.3.20)
sprockets (2.1.3, 2.1.2)
sqlite3 (1.3.6 x86-mingw32, 1.3.5 x86-mingw32)
sqlite3-ruby (1.3.3)
thor (0.14.6)
tilt (1.3.3)
tiny_tds (0.5.1 x86-mingw32)
treetop (1.4.12, 1.4.10)
tzinfo (0.3.35, 0.3.31)
uglifier (1.3.0)
It shows i18n installed. Not sure what is the issue.
$ rails --version
Rails 3.2.1
also, downloading gem package and run it using ruby setup.rb also didn't work
C:\RailsInstaller\rubygems>ruby setup.rb
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems.rb:480:in `find_files': undefined method `map' for Gem::Specification:Class (NoMethodError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems.rb:1085:in `load_plugins'
from C:/RailsInstaller/rubygems/lib/rubygems/gem_runner.rb:84:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from setup.rb:25:in `<main>'
C:\RailsInstaller\rubygems>
My gem version is
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem -v
1.8.16
I tried to download gem manually from site (from http://rubygems.org/gems/) and installed few of them. So able to install some while for most other gems it give error like below
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install mongrel
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install mongrel_services
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install mongrel_service
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install mongrel_service-0.4.0.gem
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install mongrel-1.1.5.gem
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install mongrel2-0.34.0.gem
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install win32-api-1.4.8.gem
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed win32-api-1.4.8
1 gem installed
Installing ri documentation for win32-api-1.4.8...
Installing RDoc documentation for win32-api-1.4.8...
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem install windows-api-0.4.2.gem
ERROR: While executing gem ... (Zlib::GzipFile::Error)
not in gzip format
Finally my environment details for gem is
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.16
- RUBY VERSION: 1.9.3 (2012-02-16 patchlevel 125) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/RailsInstaller/Ruby1.9.3/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1
- C:/Users/anil-ku/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>
I note that there is nothing like ruby folder under
C:/Users/anil-ku/.gem/ruby/1.9.1
the only thing under the above one is a folder named specs that looks irrelevant.
Also the path environment is windows is
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>echo %PATH%
C:\RailsInstaller\Ruby1.9.3\bin;C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\bin;C:\RailsInstaller\DevKit\bin;C:\RailsInstaller\Git\c
md;C:\RailsInstaller\Ruby1.9.3\bin;C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\bin;C:\RailsInstaller\DevKit\bin;C:\RailsInstaller\Gi
t\cmd;C:\RailsInstaller\Git\cmd;C:\RailsInstaller\Ruby1.9.3\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\Syste
m32\WindowsPowerShell\v1.0\;;C:\Program Files\cvsnt;C:\Program Files\TortoiseSVN\bin;d:\RailsInstaller\Git\cmd;d:\RailsInstaller\Ruby1.9
.3\bin
Any help for how to proceed for simple database connection with above and/or how to install gem fully?
You need to set your proxy settings for rubygems. For example set the Environment Variable like so:
SET HTTP_PROXY=http://wolfbyte:secret#pigsy:8080
From https://stackoverflow.com/a/4431/192221
I'm maintaining an ancient RoR site that we're in the process of rewriting in Django. The site was written by someone else when Rails was in its infancy, and no one kept it updated until I got to it. A night or two ago, the server went down, I suspect due to a MySQL update. In the process of trying to fix it, we broke it, and now mongrel won't start. I see this in the mongrel log:
/home/USER/rails/SITE/config/boot.rb:26:Warning: Gem::SourcUSERdex#search support for String patterns is deprecated, use #find_name
/usr/local/lib/site_ruby/1.8/rubygems.rb:812:in `report_activate_error': RubyGem version error: rails(1.2.3 not >= 3.0) (Gem::LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems.rb:223:in `activate'
from /usr/local/lib/site_ruby/1.8/rubygems.rb:258:in `activate'
from /usr/local/lib/site_ruby/1.8/rubygems.rb:257:in `each'
from /usr/local/lib/site_ruby/1.8/rubygems.rb:257:in `activate'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:33:in `require'
from /home/USER/rails/SITE/config/environment.rb:24
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:147:in `rails'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:113:in `cloaker_'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:in `call'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:149:in `listener'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:99:in `cloaker_'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:in `call'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/configurator.rb:50:in `initialize'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `new'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:84:in `run'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
from /usr/local/bin/mongrel_rails:19:in `load'
from /usr/local/bin/mongrel_rails:19
I searched around and have tried to diagnose the error. It looks like mongrel wants us to have rails 3+ which isn't possible because we're going to be replacing the site in just a few weeks and don't want to bother bringing it up to date (it just needs to work for now). How can I force mongrel to run with the current version of rails?
In config/environment.rb, we have RAILS_GEM_VERSION = '1.2.3' unless defined? RAILS_GEM_VERSION which I thought would force Rails 1.2.3. Also, here's the output of gem list:
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.2.2, 3.0.3, 1.3.3)
actionpack (3.2.2, 3.0.3, 1.13.6, 1.13.3)
actionwebservice (1.2.6, 1.2.3)
activemodel (3.2.2, 3.0.3)
activerecord (3.2.2, 3.0.3, 1.15.6, 1.15.3)
activeresource (3.2.2, 3.0.3)
activesupport (3.2.2, 3.0.3, 1.4.4, 1.4.2)
acts_as_ferret (0.5.3, 0.4.3)
arel (3.0.2, 2.0.7)
builder (3.0.0, 2.1.2)
bundler (1.1.0, 1.0.9)
cgi_multipart_eof_fix (2.5.0)
daemons (1.1.8, 1.1.0)
erubis (2.7.0, 2.6.6)
fastthread (1.0.7)
ferret (0.11.6)
gem_plugin (0.2.3)
hike (1.2.1)
i18n (0.6.0, 0.5.0)
jk-ferret (0.11.8.3, 0.11.8.2)
journey (1.0.3)
json (1.6.5)
mail (2.4.3, 2.2.15)
mime-types (1.17.2, 1.16)
mongrel (1.1.5)
multi_json (1.1.0)
polyglot (0.3.3, 0.3.1)
rack (1.4.1, 1.2.1)
rack-cache (1.2)
rack-mount (0.8.3, 0.6.13)
rack-ssl (1.3.2)
rack-test (0.6.1, 0.5.7)
rails (1.2.3)
railties (3.2.2, 3.0.3)
rake (0.9.2.2, 0.8.7)
rdoc (3.12)
sprockets (2.1.2)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10, 1.4.9)
tzinfo (0.3.32, 0.3.24)
Thanks for any and all help!
OK, I figured it out. It was incompatible gem(s). Luckily, we have a test server and a production server. We only messed with the test server last night (mongrel on the production server was working), so I did gem list on both servers, and it turned out the test server had quite a different list. I just installed and uninstalled gems on the test server until gem list produced identical lists on both servers.
Mongrel does require the latest rails version available, but your apps require rails 1.2.3, so there is a conflict.
The easiest way to avoid gems conflicts is by using different gemsets (with rvm or rbenv). Or remove the rails 3 gem if it isn't used...
I did, gem install passenger, passenger-install-apache2-module
http://localhost/
I'm getting this error.
http://pastebin.com/YfrEsv3X
Update
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.8)
actionpack (3.0.8)
activemodel (3.0.8)
activerecord (3.0.8)
activeresource (3.0.8)
activesupport (3.0.8)
arel (2.1.1, 2.0.10)
bcrypt-ruby (2.1.4)
builder (3.0.0, 2.1.2)
bundle (0.0.1)
bundler (1.0.15)
daemon_controller (0.2.6)
devise (1.3.4)
erubis (2.7.0, 2.6.6)
fastthread (1.0.7)
i18n (0.6.0, 0.5.0)
mail (2.3.0, 2.2.19)
mime-types (1.16)
mysql (2.8.1)
mysql2 (0.3.2)
orm_adapter (0.0.5)
passenger (3.0.7)
pg (0.11.0)
polyglot (0.3.1)
postgres-pr (0.6.3)
rack (1.3.0, 1.2.3)
rack-mount (0.8.1, 0.6.14)
rack-test (0.6.0, 0.5.7)
rails (3.0.8)
railties (3.0.8)
rake (0.9.2, 0.8.7)
rubygems-update (1.8.5)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.27)
warden (1.0.4)
You need to install the bundler gem as well.
Update
Now that the OP has posted his gemset...
You must have two gemsets, usually this is because you're using two different rubys. The gem command is just a script, with a shebang line pointing to a Ruby. The gem list you're showing will be the gemset for that Ruby. You can see this with this command: head -1 $(which gem)
Your passenger configuration must be pointing to a different Ruby with a different gemset. You can see this in your passenger.conf lines for Apache.
I suspect after installing the bundler gem - you may experience other problems if your Gemfile doesn't include all the gems your project requires.
So next time - look at the error message.
no such file to load -- bundler
from the above example - you can notice that 'bundler' is causing the problem.
That will give you a clue as what other gems you'd need to install and possibly missed out in your Gemfile - in which case issue the command:
gem install <missing-gem>