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
Related
I am having problem with setting PATH variable in Ruby on Rails. Constraints are: I have to use Ruby 1.8.7 and Rails 2.2.2 and Rubygems 1.3.5. These are the outputs of commands:
hemant#hemant-laptop:~$ which gem
/usr/bin/gem
hemant#hemant-laptop:~$ which ruby
/usr/local/bin/ruby
hemant#hemant-laptop:~$ which rails
/var/lib/gems/1.8/bin/rails
hemant#hemant-laptop:~$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.5
- 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/hemant/.gem/ruby/1.8
I have added these lines into my .bashrc file:
export PATH=$PATH:/var/lib/gems/1.8/bin
export PATH=$PATH:/usr/bin/gem
When I echo PATH variable:
hemant#hemant-laptop:~$ echo $PATH
usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:bin:/usr/games:/var/lib/gems/1.8/bin:/usr/bin/gem
Real problem is that when I run script/server in my rails app directory, It errors:
./script/../config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:1:in 'require': no such file to load -- rubygems (LoadError)
When I googled it, I got to know that it is due to flaw in PATH variable configuration, but I can't understand what value I should give to it. The above two export statements are just hit and trials but they didn't solve the problem.
Can someone please guide me what value PATH must be set to and how one can deduce the value from outputs of various commands.
[EDIT]
Running gem list gives this:
actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activeresource (2.2.2)
activesupport (2.2.2)
chronic (0.10.2)
diff-lcs (1.2.4)
image_science (1.2.1)
libv8 (3.16.14.3)
mysql (2.9.1)
rack (1.5.2)
rails (2.2.2)
rake (0.8.7)
ref (1.0.5)
rspec (1.2.9)
rspec-core (2.14.6)
rspec-expectations (2.14.0)
rspec-mocks (2.14.4)
rspec-rails (1.2.9)
rubygems-update (2.1.10)
therubyracer (0.12.0)
ZenTest (4.3.0)
To extend your path with new paths which contain executables you need to specify the directory. For the gem command you now pointing to the executable itself.
Try this:
export PATH=$PATH:/usr/bin:/usr/local/bin:/var/lib/gems/1.8/bin
This should include all executables in your path. Make sure to reload your .bashrc before trying again.
source ~/.bashrc
One other solution to solve your problems:
Spin-up a virtual machine which is old enough to have the old stuff. Probably ubuntu 12.04 is old enough.
Hullo,
The following issue has really been bothering me much of late. I haven't been able to figure out exactly why it exists.
I have a Rails 2 application, specifically Rails 2.3.5, built that I am trying to deploy on a development machine running Ubuntu 10.10. I have set up everything properly, to the best of my knowledge. Here's some proof:
ayaz#ubuntu$ rails -v
Rails 2.3.5
ayaz#ubuntu$ gem -v
1.3.7
ayaz#ubuntu$ ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
ayaz#ubuntu$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2010-06-23 patchlevel 299) [i686-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/ayaz/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
ayaz#ubuntu$ gem list
*** LOCAL GEMS ***
actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
atomic (1.1.10)
daemons (1.1.9)
eventmachine (1.0.3)
i18n (0.6.4)
kgio (2.8.0)
minitest (4.7.5)
multi_json (1.7.7)
rack (1.5.2, 1.0.1)
rails (2.3.5)
raindrops (0.11.0)
rake (10.1.0)
thin (1.5.1)
thread_safe (0.1.2)
tzinfo (0.3.37)
unicorn (4.6.3)
If I run the application via script/server, it runs fine:
ayaz#ubuntu$ script/server
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-07-28 01:10:37] INFO WEBrick 1.3.1
[2013-07-28 01:10:37] INFO ruby 1.8.7 (2010-06-23) [i686-linux]
However, if I run it, say, via unicorn or thin, I keep getting this gem error:
ayaz#ubuntu$ thin start
>> Using rails adapter
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.
unicorn_rails gives the same error. Now, I've looked around and found suggestions about adding a require "rubygems" beforehand. I have tried it: I have added the line at the top of config/boot.rb as well as config/environment.rb, but to no avail.
Would anyone be kind enough to point me in the right direction, please?
Thanks much!
I would expect that you have multiple versions of ruby/rubygems running (via RVM or rbenv for example). This might help you determine which ruby is actually used:
which ruby
which gem
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
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)
I am trying to install rails on Ubuntu 8.10, and met following errors. Please help me get through.Thanks.
root#pierr-desktop:~# gem install rails
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response 500 (http://gems.rubyforge.vm.bytemark.co.uk/gems/actionpack-2.3.4.gem)
#other information
root#pierr-desktop:~# ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
root#pierr-desktop:~# gem -v
1.2.0
root#pierr-desktop:~# gem list
*** LOCAL GEMS ***
activerecord (2.3.4)
activesupport (2.3.4, 1.4.4)
daemons (1.0.10)
gem_plugin (0.2.3)
rack (1.0.1)
rake (0.8.7, 0.8.3)
wirble (0.1.3)
You might just have to try again.
Looks like the server returned an error 500 which seems to be intermittent.