简体   繁体   中英

when I am deploy my ror application on production then I am getting following error

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

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.

Try:

gem update rails

...on the server, not your development machine

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM