views:

678

answers:

1

Hi.

Everytime I start my Rails applications I get LoadError with the following output.

On Rails 2.3.8:

no such file to load -- sqlite3/sqlite3_native
<internal:lib/rubygems/custom_require>:29:in `require'

On Rails 3.0.0:

no such file to load -- bundler
<internal:lib/rubygems/custom_require>:29:in `require'

I run the applications in the production mode on a development machine using Nginx + Passenger.

What is the reason of this issue? How can I solve it?

Thanks.

Debian GNU/Linux 5.0.6;

Ruby 1.9.2;

Rubygems 1.3.7;

Ruby on Rails 2.3.8, 3.0.0;

Nginx 0.8.50;

Passenger 2.2.15;

sqlite3-ruby 1.3.1;

bundler 1.0.0.rc.6.

Updated


All of my gems is installed by the unprivileged user in the local directory /home/<usernam>/.gem. If it helps, here's the gem env output:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [i686-linux]
  - INSTALLATION DIRECTORY: /home/<username>/.gem
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - EXECUTABLE DIRECTORY: /home/<username>/.gem/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /home/<username>/.gem
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-ri --no-rdoc"
     - :gemhome => "/home/<username>/.gem"
     - :gempath => ["/home/<username>/.gem"]
  - REMOTE SOURCES:
     - http://rubygems.org/

Updated


I tackled with the problem. Its source was that I defined a custom gem path. That is I added to the ~/.gemrc file the following lines:

:gemhome: /home/<username>/.gem
:gempaths:
  - /home/<username>/.gem

Thus all of my gems was placed in the specified directory but not the default one. For some reason Rubygems coundn't find it there and rose an exception.

When I removed that lines from the file the default paths was set for Rubygems and after I installed all the required gems and loaded my Rails applications all began to work.

Once again, the bug conditions is:

  1. Nginx + Passenger;
  2. The gempath is set to /home/<unprivileged_user>/.gem in ~/.gemrc;
  3. An init.d script is creaded and added to the boot sequence (update-rc.d nginx defaults);
  4. System is rebooted, server is started atomaticlally;
  5. http://localhost/my_rails_app;
  6. LoadError; no such file to load -- <gem_name>; <internal:lib/rubygems/custom_require>:29:in `require'.

Why can't Rubygems find gems in the custom location but can find them in default? That's the question.

A: 

Check your system to locate where your rubies and gems are installed ( you can do this by "which ruby" and "which gem"). Usually, they're installed in the same folder (/usr/bin or /usr/local). If they are in different locations, there might be load error. Just a suggestion.

Shreyas Satish
Sudo has nothing to do with installing, and nothing in here implies that he is using a system that uses sudo (ie Ubuntu, since most others use su).
mathepic
@Shreyas Satish: They're at the same folder (`/usr/local/bin`).
Shamaoke