Rails: Command not Found after successful install - ruby-on-rails

So I installed ruby, gems and rails - however whenever I type rails I get the rails: Command not found. error.
I did a dump of my local gems, which I'll include below
*** LOCAL GEMS ***
actionmailer (3.2.7)
actionpack (3.2.7)
activemodel (3.2.7)
activerecord (3.2.7)
activeresource (3.2.7)
activesupport (3.2.7)
arel (3.0.2)
bigdecimal (1.1.0)
builder (3.0.0)
bundler (1.1.5)
daemon_controller (1.0.0)
erubis (2.7.0)
fastthread (1.0.7)
hike (1.2.1)
i18n (0.6.0)
io-console (0.3)
journey (1.0.4)
json (1.5.4)
mail (2.4.4)
mime-types (1.19)
minitest (2.5.1)
multi_json (1.3.6)
mysql (2.8.1)
passenger (3.0.14)
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.7)
railties (3.2.7)
rake (0.9.2.2)
rdoc (3.12, 3.9.4)
sprockets (2.1.3)
thor (0.15.4)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)
I also checked my gem environment setup (below)
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-freebsd8.1]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-freebsd-8
- GEM PATHS:
- /usr/local/lib/ruby/gems/1.9.1
- /root/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
and echo'd my $PATH variable /sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin
I attempted to go into where the whereis command told me rails was installed
whereis rails
rails: /usr/local/bin/rails
and execute rails from there, again , I got rails: Command not found.
I am running FreeBSD on a VPS, and would like to learn some additional languages beyond PHP, but I can't seem to figure this one out for the life of me ... any help would be amazing.

If you installed Rails only via Bundler, then rails will only be accessible if you run bundle exec rails.
A "naked" rails command will only exist if you gem install rails directly without Bundler.

If you are using rbenv, it is possible you will need to run rbenv rehash after installing your dependencies for you rails application. ie. bundle install
From digitalocean:
Whenever you install a new version of Ruby or a gem that provides commands, you should run the rehash sub-command. This will install shims for all Ruby executables known to rbenv, which will allow you to use the executables:
Hope this helps!

If your app is running in production but can't find rails command on root then this might help:
run
script/rails c ENV
Instead of
rails c ENV
I had the same issue and resolved it this way. The app was running with nginx/passenger but wasn't able to run rails console/ rails server on production.

I'm certain that your problem was caused by gems in the other gem directory, here:
/root/.gem/ruby/1.9.1
So for future readers, look in your other GEM PATHS.
(And then if that's wrong I'll update this answer appropriately.)

I just encountered this same problem under another scenario where I installed rails along with rvm on ubuntu-20.04.
I had to add the following line to my ~/.bashrc ( or `~/.profile')
# Where you installed rvm...
source ~/.rvm/scripts/rvm

Related

installing rails 4.2 on ruby 2.2.0 using RVM generates "Your Ruby version is 2.2.0, but your Gemfile specified 2.1.5"

This is an update for the problem mentioned below:
I just found out that there is a Gemfile and Gemfile.lock in the root directory i.e system Home directory, and when ever i create a new gemset i believe it uses this gemfile. After installing rails in a newly created gemset, when check the rails version or try to create a new app, it shows the error Your ruby version is 2.2.0, but your Gemfile specifies 2.1.5, cause the Gemfile file in my home directory contains that ruby version, and if delete that Gemfile, and try to create a new rails app, it searches for that Gemfile.
I am current going through a hard time. I was starting a new project in ruby 2.2.0 and rails 4.2.0 and started by creating a gemset using RVM inside my project folder.
created gemset.
$rvm use ruby-2.2.0#myapp --ruby-version --create
Installed latest rails
$gem install rails
After that i checked the rails version just to verify
$rails -v
but instead i get a notification saying Your Ruby version in 2.2.0 but your Gemfile specified 2.1.5. I also don't have my application folder yet, cause i get the same output if i try to $rails new .
Following are the RVM related outputs
My RVM version is 1.26.10.
rvm gemset list
gemsets for ruby-2.2.0 (found in /Users/samy/.rvm/gems/ruby-2.2.0)
(default)
global
student-portal
=> myapp
gem list for global gemset
bigdecimal (1.2.7, 1.2.6)
bundler (1.7.13)
bundler-unload (1.0.2)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
io-console (0.4.3)
json (1.8.2, 1.8.1)
mini_portile (0.6.2)
minitest (5.5.1, 5.4.3)
nokogiri (1.6.6.2)
power_assert (0.2.2)
psych (2.0.12, 2.0.8)
rake (10.4.2)
rdoc (4.2.0)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
test-unit (3.0.9, 3.0.8)
gem list for myapp gemset
actionmailer (4.2.0)
actionpack (4.2.0)
actionview (4.2.0)
activejob (4.2.0)
activemodel (4.2.0)
activerecord (4.2.0)
activesupport (4.2.0)
arel (6.0.0)
bigdecimal (1.2.7, 1.2.6)
builder (3.2.2)
bundler (1.7.13)
bundler-unload (1.0.2)
erubis (2.7.0)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
globalid (0.3.2)
hike (1.2.3)
i18n (0.7.0)
io-console (0.4.3)
json (1.8.2, 1.8.1)
loofah (2.0.1)
mail (2.6.3)
mime-types (2.4.3)
mini_portile (0.6.2)
minitest (5.5.1, 5.4.3)
multi_json (1.10.1)
nokogiri (1.6.6.2)
power_assert (0.2.2)
psych (2.0.12, 2.0.8)
rack (1.6.0)
rack-test (0.6.3)
rails (4.2.0)
rails-deprecated_sanitizer (1.0.3)
rails-dom-testing (1.0.5)
rails-html-sanitizer (1.0.1)
railties (4.2.0)
rake (10.4.2)
rdoc (4.2.0)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
sprockets (2.12.3)
sprockets-rails (2.2.4)
test-unit (3.0.9, 3.0.8)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
tzinfo (1.2.2)
which ruby gives
/Users/samy/.rvm/rubies/ruby-2.2.0/bin/ruby
which rails gives
/Users/samy/.rvm/gems/ruby-2.2.0#myapp/bin/rails
the file contains
#!/usr/bin/env ruby_executable_hooks
#
# This file was generated by RubyGems.
#
# The application 'railties' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0"
if ARGV.first
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
version = $1
ARGV.shift
end
end
gem 'railties', version
load Gem.bin_path('railties', 'rails', version)
I tried removing and reinstalling RVM but i did not work.
Also i tried making app with ruby 2.1.5 with different gemset and all, but there i get different error when i try to do rails new app. i get the Could not find slop-3.6.0 in any of the sources
Run 'bundle install' to install missing gems., but once i do the bundle install i cannot run the rails new app command as it notifies
Can't initialize a new Rails application within the directory
of another, please change to a non-Rails directory first.
Any help would be greatly appreciated. If you need any more info i am ready to provide it.
Thanks in advance.
Cheers.
I had similar issues and restarting from scratch using this guide helped a lot. Though it seemed yet another guide, I found it to be a bit more systematic and detailed than the others.
Rails Apps Guide: Install Ruby on Rails ยท Ubuntu Linux
Alternatively, try Rails Apps Guide: Updating to Rails 4.2
Note:
Rails is not just a Ruby gem, it is a complex and rapidly evolving
ecosystem. It is important to set up your development environment with
the most current version of all the gems that are needed for
development.

attempting to execute any command starting "rails" yields "Could not locate Gemfile"

I am trying to install a new rails app. I've already got several rails apps on my machine, all working fine.
$ rails new app
Could not locate Gemfile
Then I figured I'd run a trace to figure out what was going on, as you wouldn't expect to have a Gemfile at this point anyway, as typically the above command would create an entire new rails app in a directory named app with the Gemfile contained within that directory.
$ rails new app --trace
Could not locate Gemfile
So I tried to reinstall everything on my computer via this detailed guide:
http://railsapps.github.com/installing-rails.html#gems
After the first 20 or so steps, I got to this command:
$ rake -v
Could not locate Gemfile
I assume something is off on my setup somewhere, but I can't see anything off.
Here are my rvm settings:
$ rvm version
rvm 1.18.10 (latest) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]
$ rvm list
rvm rubies
jruby-1.6.7 [ x86_64 ]
ruby-1.9.1-p431 [ i386 ]
ruby-1.9.3-p194 [ x86_64 ]
ruby-1.9.3-p286 [ x86_64 ]
ruby-1.9.3-p327 [ x86_64 ]
=* ruby-1.9.3-p385 [ x86_64 ]
# => - current
# =* - current && default
# * - default
$ rvm gemset list
gemsets for ruby-1.9.3-p385 (found in /Users/paul/.rvm/gems/ruby-1.9.3-p385)
(default)
global
=> rails32
Here are the gems installed on my rails32 gemset
$ gem list
*** LOCAL GEMS ***
actionmailer (3.2.12, 3.2.11)
actionpack (3.2.12, 3.2.11)
activemodel (3.2.12, 3.2.11)
activerecord (3.2.12, 3.2.11)
activeresource (3.2.12, 3.2.11)
activesupport (3.2.12, 3.2.11)
arel (3.0.2)
builder (3.0.4)
bundler (1.2.4)
erubis (2.7.0)
hike (1.2.1)
i18n (0.6.1)
journey (1.0.4)
json (1.7.7)
mail (2.4.4)
mime-types (1.21)
multi_json (1.6.1)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.12, 3.2.11)
railties (3.2.12, 3.2.11)
rake (10.0.3)
rdoc (3.12.1)
rubygems-bundler (1.1.0)
rvm (1.11.3.6)
sprockets (2.2.2)
thor (0.17.0)
tilt (1.3.3)
treetop (1.4.12)
tzinfo (0.3.35)
Bundler Version
$ bundle --version
Bundler version 1.2.4
.gemrc file
$ cat ~/.gemrc
---
:backtrace: false
:benchmark: false
:bulk_threshold: 1000
:sources:
- http://rubygems.org/
- https://rubygems.org
:update_sources: true
:verbose: true
Everything seems to look fine, very frustrated, please help.
This errors happens only with commands prefixed with bundle exec or for bundle install without Gemfile in current dir.
My assumption is you might be running commands that enable bundler, check:
which rake
to find out what command is run.
bundle install
in the project directory fixed it for me.
After that, I ran into this error:
There was an error in your Gemfile, and Bundler cannot continue.
And this was fixed with:
gem update bundler
Then my re-install of Ruby and Rails finally worked. It only took about four hours to make it work :-/

Ruby on Rails issue in Windows 7 behind websense and firewall

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

Rails + Passenger + Apache Production Deployment: "Missing Rails 2.3.5 gem" but it's installed

I've looked all over the web for about a week now and not found a solution to my problem. I have a Ruby on Rails application I'm trying to deploy to a production Ubuntu 10.04 server edition box. I've got Apache2.2 and Passenger3.0.0 installed with Ruby 1.8.7, Rails 2.3.5 and RubyGems 1.3.7. My rails application is in /var/rails_app_name/ and rubygems/ruby is installed at /var/lib/gems/1.8
I have a test server with ubuntu 10.04 (gui edition) running the same setup and configuration which works like a charm. The only difference is my rails application root is in the user local folder e.g. /home/username/rails_app_name/
My problem is that on the production server, Passenger is giving me an error: "Missing the Rails 2.3.5 gem. Please 'gem install -v=2.3.5 rails'. update your RAILS_GEM_VERSION...."
I installed the rails gem in both gem directories listed by running a gem environment. Here are some config results:
%> gem environment
RUBYGEMS VERSION: 1.3.7
RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
INSTALLATION DIRECTORY: /var/lib/gems/1.8
RUBY EXECUTABLE: /usr/bin/ruby1.8
EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
RUBYGEMS PLATFORMS:
ruby
x86-linux
GEM PATHS:
/var/lib/gems/1.8
/home/sross/.gem/ruby/1.8
GEM CONFIGURATION:
:update_sources => true
:verbose => true
:benchmark => false
:backtrace => false
:bulk_threshold => 1000
REMOTE SOURCES:
http://rubygems.org/
%> gem list
actionmailer (2.3.5)
actionpack (2.3.5)
activemodel (3.0.3)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (3.0.3, 2.3.5)
acts_as_audited (1.1.1)
arel (2.0.4)
authlogic (2.1.6)
builder (2.1.2)
cancan (1.4.1)
daemon_controller (0.2.5)
fastthread (1.0.7)
file-tail (1.0.5)
i18n (0.4.2)
passenger (3.0.0)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)
spruz (0.2.2)
tzinfo (0.3.23)
%> which gem
/usr/bin/gem
%> which ruby
/usr/bin/ruby
** /etc/apache2/mods-enabled/passenger.conf **
PassengerRoot /var/lib/gems/1.8/gems/passenger-3.0.0
PassengerRuby /usr/bin/ruby
** /etc/apache2/mods-enabled/passenger.load **
LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-3.0.0/ext/apache2/mod_passenger.so
Let me know if you want to see anything else. I installed everything with sudo, all my rubygems directories, ruby directories, application directories are chmod 755 so www-data should have access correct? I've tried setting GEM_HOME to both rubygems paths and making sure the rails gem is in there too.
Help this is killing me!
Update:
gem list for test server (which works fine)
abstract (1.0.0)
actionmailer (3.0.0, 2.3.8, 2.3.5)
actionpack (3.0.0, 2.3.8, 2.3.5)
activemodel (3.0.0)
activerecord (3.0.0, 2.3.8, 2.3.5)
activeresource (3.0.0, 2.3.8, 2.3.5)
activesupport (3.0.0, 2.3.8, 2.3.5)
acts_as_audited (1.1.1)
arel (1.0.1)
authlogic (2.1.6)
builder (2.1.2)
bundler (1.0.0)
cancan (1.3.4)
cgi_multipart_eof_fix (2.5.0)
daemon_controller (0.2.5)
daemons (1.1.0)
dbi (0.4.5)
deprecated (2.0.1)
erubis (2.6.6)
fastthread (1.0.7)
file-tail (1.0.5)
gem_plugin (0.2.3)
mail (2.2.5)
mime-types (1.16)
mongrel (1.1.5)
mongrel_cluster (1.0.5)
mysql (2.8.1)
passenger (3.0.0)
polyglot (0.3.1)
rack (1.2.1, 1.1.0, 1.0.1)
rack-mount (0.6.13)
rack-test (0.5.4)
rails (2.3.5)
railties (3.0.0)
rake (0.8.7)
spruz (0.2.2)
thor (0.14.0)
treetop (1.4.8)
tzinfo (0.3.23)
validates_date_time (1.0.0)
I pulled in a co-worker to take another look at this problem and we found this post to convert the misleading and unhelpful error listed in my original post into the actual error text. The root of the problem ended up coming from which versions of particular gems were installed and where they were installed. AFIAK I ended up needing rack version 1.0.0 and version 1.0.1.
So passing what I learned from this problem to others: If you get a "Missing the Rails X.X.X gem..." take a look at your boot.rb file and make the change explained in the link above. This will display the real problem, which seems to always be an incorrect version of some other gem causing the rails gem to fail it's load process.
Thanks to everyone who spent time looking into my original post!
Can you check apache for your ruby ? Look for
PassengerRuby /usr/bin/ruby
Its possible you have passenger looking at the wrong ruby (could be multiple installed in 2 directories)

Ruby deployment server problem: Missing the Rails 2.3.5 gem

I'm trying to install a rails server for my application. I'm using ubuntu 10.04 TLS with apache2 as web server. I made some search on google but I do not found something that help me. When I tried to connect on my application I have following error:
The application has exited during startup (i.e. during the evaluation of config/environment.rb). The error message can be found below. To solve this problem, please follow any instructions in the error message.
Error message:
Missing the Rails 2.3.5 gem. Please gem install -v=2.3.5 rails, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.
So I do not understand since rails is installed:
desktop:/etc/apache2$ rails -v
Rails 2.3.5
gem list:
gem list
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
arel (1.0.1)
builder (2.1.2)
bundler (1.0.0)
cgi_multipart_eof_fix (2.5.0)
daemon_controller (0.2.5)
daemons (1.1.0)
erubis (2.6.6)
fastthread (1.0.7)
file-tail (1.0.5)
gem_plugin (0.2.3)
i18n (0.4.1)
linecache (0.43)
mail (2.2.5)
mime-types (1.16)
mongrel (1.1.5)
needle (1.3.0)
net-ssh (1.1.4)
passenger (2.2.15)
polyglot (0.3.1)
rack (1.0.1)
rack-mount (0.6.13)
rack-test (0.5.4)
rails (2.3.5)
rake (0.8.7)
ruby-debug-base (0.10.3)
ruby-debug-ide (0.4.5)
rubyzip (0.9.4)
spruz (0.1.5)
sqlite3-ruby (1.3.1)
thor (0.14.0)
treetop (1.4.8)
tzinfo (0.3.23)
MORE INFO: I'm developping on windows and my server is a Linux maybe the problem is there. I don't know. anyway thanks in advance for help.
Even if I'm root user I cannot open console:
root#et1-desktop:/home/et1/wip3/sophia/script# ./console
Loading development environment (Rails 2.3.5)
sh: irb: not found
gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/lib/ruby/gems/1.8
- /home/et1/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org/", "http://gems.rubyforge.org"]
- REMOTE SOURCES:
- http://gems.rubyforge.org/
- http://gems.rubyforge.org
is the following line added in environment.rb
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
and also try this command in terminal. see is there any rails gem installed
gem list
I also saw this problem when there are multiple ruby version in the system that are refering to different gem repositories. If this is the case, these commands should help debugging:
which ruby
which gem
and from docs rubygem]1
gem environment
It could be that the user which you are logging in at the command prompt does not have the same list of gems as the user you are running the server as.
This commonly happens when you have installed gems as the command line user without using sudo which means they will be available only to that user.
It would be worth checking where your gems are installed. If they are in a folder .gem from your user's home directory that indicates they are installed for that user only.
I would try firing up a shell as the user the server runs as and ensuring that user has the gem access you require.
I think I found my problem, First I follow the instruction of following links: http://gembundler.com/rails23.html
Next I run command rake db:migrate RAILS_ENV=production
After that the server is working fine.
Thanks to all for help.
I really hope this helps someone: I was running into the same problem "Missing the Rails 2.3.5 gem" ... The way that I solved it was I moved my application to heroku stack bamboo-ree-1.8.7
heroku stack:migrate bamboo-ree-1.8.7 and in my config/environment.rb file I added config.gem "rack", :version => '1.0.1'
The problem is that rack 1.1.0 will not work with rails 2.3.5

Resources