2
votes

in gem_original_require': no such file to load -- haml (MissingSourceFile)

but this gem already istalled.

I have also plugin for this path :-/home/techvant/rails_app/techease/vendor/plugins/haml/init.rb

this init file having following code : -

    begin
         require File.join(File.dirname(__FILE__), 'lib', 'haml') # From here
       rescue LoadError
         require 'haml' # From gem
    end

What do I need to resolve this error please help.

Following is the error trace.

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require': no such file to load -- haml (MissingSourceFile) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in require' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in new_constants_in' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in require' from /home/techvant/rails_app/techease/vendor/plugins/haml/init.rb:4:in evaluate_init_rb' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin.rb:146:in evaluate_init_rb' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/kernel/reporting.rb:11:in silence_warnings' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin.rb:142:in evaluate_init_rb' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin.rb:48:in load' from /home/techvant/rails_app/techease/config/../vendor/plugins/siteninja/engines/lib/engines/plugin.rb:77:in load' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin/loader.rb:38:in load_plugins' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin/loader.rb:37:in each' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/rails/plugin/loader.rb:37:in load_plugins' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:348:in load_plugins' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:163:in process' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in send' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/initializer.rb:113:in run' from /home/techvant/rails_app/techease/config/environment.rb:9 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in require' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in new_constants_in' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in require' from /usr/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/commands/server.rb:84 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from script/server:3

4
By removing the ' does that solve anything?Anthony Forloney
What version of rails are you on?wesgarrison

4 Answers

1
votes

Since haml is a gem, I'd put it in environment.rb:

config.gem 'haml'

Then, unpack and add it to the repo:

rake gems:install
rake gems:unpack

Finally, remove the haml plugin references you've got.

0
votes

Try:

gem update rails

...on the server, not your development machine

0
votes

you can try to unpack the gems so they are inside your rails app directory, this will eliminate your rails app from depending on local gems in your system. cheers!

0
votes

I had a great deal of trouble with this problem as well. Here are the steps I finally took to solve it.

First, install the gem.

put

config.gem 'haml' 

in your environment.rb file. I actually had to put it in my environments/development.rb and environments/production.rb (etc.) as it was complaining about not knowing the rails_env. Which is not optimal, but it worked. then run

rake gems:install

Then

mkdir -p /vendor/plugins/haml
cp vendor/gems/haml-2.2.0/init.rb /vendor/plugins/haml/init.rb

then restart your rails server.