views:

56

answers:

4

Hi, 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
+1  A: 

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
siulamvictor
yes :more config/environment.rb# Be sure to restart your server when you modify this file# Specifies gem version of Rails to use when vendor/rails is not presentRAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
Goueg83460
i add one more command for checking. :)
siulamvictor
ok I update description with gem list ;)
Goueg83460
weird... have you check with the log? any hints in there?
siulamvictor
I can see the same thing in apache2 error logs: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.
Goueg83460
It is very strange because I have same error when I try to run the console: ./consoleLoading development environment (Rails 2.3.5)sh: irb: not found
Goueg83460
oops.... i faced this problem before. and i got a hints in the rails development.log. i dun remember what exactly it is becoz it's long time ago. sorry mate, can't help.
siulamvictor
no problem, anyway thanks for your help.
Goueg83460
A: 

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.

Shadwell
I checked in my user home .gem and I can only see one gem: needle-1.3.0, otherwise there no more gems. I don't really know how check if user can access to needed gems, and I don't really know witch user is trying to call this gem.
Goueg83460
ok so I found the user www-data. when I'm logged with this user I can run rails -v that give version 2.3.5.
Goueg83460
A: 

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  
poseid
which ruby/usr/bin/ruby
Goueg83460
which gem/usr/bin/gem
Goueg83460
I just added gem env in first description
Goueg83460
where: ls -ls /usr/bin/ruby0 lrwxrwxrwx 1 root root 7 2009-06-12 14:13 /usr/bin/ruby -> ruby1.8
Goueg83460
I tried to follow several tuto without succeed installed it, I don't understand why it seems easy to deploy it ... :(
Goueg83460
sorry not installed it but do it works.
Goueg83460
so, I dont understand if you have it working now, or not. in case of your irb problem, try the same: which irb
poseid
does someone has any idea please ?? I tried it on another ubuntu and I get exactly same problem. I really need some help to get to works. I'm sure that I'm not so far from the end ...
Goueg83460
Sorry I did not say correct things. What I wanted to say is: I installed all gems required but I always have same error message about rails (I tried to configure it on different environment). About irb I write it in case of it can explain better my problem. But I'm not sure it is linked. So Actually I still have the problem. I really need help. Thanks in advance.
Goueg83460
You are writing about two different users: www-data and root. Which user are you working with? 1. Do list the gem environment for both users and check if they are different. 2. If the gems are really there, it can be that you have your path not set properly. list your path for both users with env. 3. if path is setup correctly it can be still a permission problem. list ls -l for both gem path and esp. the rails gem.
poseid
A: 

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.

Goueg83460