Search code examples
ruby-on-railsrubyrubygemsprawn

Ruby on Rails application couldn't be started: no such file to load --multi_json (MissingSourceFile)


I'm new to ruby on rails, and I wanted to install Prawn Library. But running gem install prawn fails and I get ttfunk requires ruby version 1.9.3 . So I had to add gem 'prawn', '0.12.0' to the Gemfile, and I noticed that there is no such file in our project, so I added it under:

source 'https://rubygems.org'
gem 'rake', '0.8.7'
gem 'rails', '2.3.5'
gem 'prawn', '0.12.0'

This is the gem list:

actionmailer (2.3.5)
actionpack (2.3.5)
activemodel (3.2.1)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
afm (0.2.2)
arel (3.0.1)
Ascii85 (1.0.2)
builder (3.0.0)
bundler (1.0.22)
daemon_controller (1.0.0)
declarative_authorization (0.5.1)
erubis (2.7.0)
faraday (0.9.1)
fastercsv (1.5.5)
fastthread (1.0.7)
git (1.2.9.1)
hashery (2.1.1)
hike (1.2.1)
httpauth (0.2.1)
i18n (0.4.2)
journey (1.0.2)
json (1.6.5)
mail (2.4.1)
mime-types (1.17.2)
multi_json (1.8.2)
multipart-post (2.0.0)
mysql (2.9.1)
nokogiri (1.5.6)
oauth2 (0.6.1)
passenger (3.0.11)
pdf-reader (1.3.3)
polyglot (0.3.3)
prawn (0.12.0)
prawn-core (0.6.3)
rack (1.4.1, 1.0.1)
rack-cache (1.1)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (2.3.5)
railties (3.2.1)
rake (0.8.7)
rdoc (3.12)
ruby-progressbar (1.7.5)
ruby-rc4 (0.1.5)
rubygems-update (1.3.7)
rush (0.6.8)
searchlogic (2.5.19)
session (3.2.0)
sprockets (2.1.2)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
ttfunk (1.0.3)
tzinfo (0.3.31)
validatable (1.6.7)
vote_fu (0.0.11)

So you can notice that multi_json is installed as a gem. I tried uninstalling and re-installing it, I also checked its permissions, and tried to restart nginx server several times, but none of this worked. I'm not able to solve this problem, I opened the dependencies.rb file where the error points to and I found this:

def require(file, *extras) #:nodoc:
    if Dependencies.load?
      Dependencies.new_constants_in(Object) { super }
    else

#line 58 super

 end
  rescue Exception => exception  # errors from required file
    exception.blame_file! file
    raise
  end

Please help me figure this out.

UPDATE: Big thanks for Mateusz Czerwiński I added gem 'multi_json', '~> 1.11', '>= 1.11.2' to my gemfile and run bundle install, and the first error is gone. but now I'm getting this error:

no such file to load -- i18n/backend/fallbacks (MissingSourceFile)

I checked the gem list and I have i18n (0.4.2) installed.I also checked if i18n/backend/fallbacks.rb file is there, and I found it under ruby/gems/1.8/gems/i18n-0.4.2/lib/i18n/backend, and I changed its permissions. But still it didn't work.

I copied the gems required by multi_json from /usr/local/lib/ruby to /multi_json/ruby. This seems to fix the gems errors, but I'm having the following error now:

Error message:
    uninitialized constant FedenaPlugin::Authorization
Exception class:
    NameError

I don't understand why all these errors are here, and why installing a gem caused my application to stop. And I don't understand what the last error indicate.


Solution

  • You have a lot of unnecessary gems, for fedena these are the gems you should have:

    actionmailer (2.3.5)
    actionpack (2.3.5)
    activerecord (2.3.5)
    activeresource (2.3.5)
    activesupport (2.3.5)
    Ascii85 (1.0.2)
    bundler (1.10.6, 1.0.22)
    daemon_controller (1.0.0)
    declarative_authorization (0.5.1)
    faraday (0.9.1)
    fastercsv (1.5.5)
    fastthread (1.0.7)
    git (1.2.9.1)
    hashery (2.1.1)
    httpauth (0.2.1)
    i18n (0.4.2)
    json (1.6.5)
    multi_json (1.11.2)
    multipart-post (2.0.0)
    mysql (2.9.1)
    nokogiri (1.5.6)
    oauth2 (0.6.1)
    passenger (3.0.11)
    rack (1.4.1, 1.0.1)
    rack-cache (1.1)
    rack-ssl (1.3.2)
    rack-test (0.6.1)
    rails (2.3.5)
    rake (0.8.7)
    rdoc (3.12)
    ruby-progressbar (1.7.5)
    ruby-rc4 (0.1.5)
    rush (0.6.8)
    searchlogic (2.5.19)
    session (3.2.0)
    tzinfo (0.3.31)
    validatable (1.6.7)
    vote_fu (0.0.11)
    

    So uninstall other gems, and remove multi_json folder in addition to Gemfile and Gemfile.lock files, and try this command:

    gem install prawn -v 0.6.3
    

    Hope it works.