[英]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. 我是红宝石的新手,我想安装Prawn Library。 But running
gem install prawn
fails and I get ttfunk requires ruby version 1.9.3
. 但是运行
gem install prawn
失败,并且我得到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: 因此,我必须在Gemfile中添加gem'prawn','0.12.0',并且我注意到我们的项目中没有这样的文件,因此我将其添加到:
source 'https://rubygems.org'
gem 'rake', '0.8.7'
gem 'rails', '2.3.5'
gem 'prawn', '0.12.0'
This is the gem list
: 这是
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. 因此,您会注意到multi_json是作为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.
我尝试卸载并重新安装它,还检查了它的权限,并尝试了几次重启nginx服务器,但是这些都不起作用。 I'm not able to solve this problem, I opened the dependencies.rb file where the error points to and I found this:
我无法解决此问题,我打开了错误指向的dependencies.rb文件,发现了这一点:
def require(file, *extras) #:nodoc:
if Dependencies.load?
Dependencies.new_constants_in(Object) { super }
else
#line 58 super
#第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. 更新:非常感谢
gem 'multi_json', '~> 1.11', '>= 1.11.2'
我在gem 'multi_json', '~> 1.11', '>= 1.11.2'
添加了gem 'multi_json', '~> 1.11', '>= 1.11.2'
并运行bundle install,第一个错误消失了。 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. 我检查了宝石列表并安装了i18n(0.4.2)。我还检查了是否存在i18n / backend / fallbacks.rb文件,并在ruby / gems / 1.8 / gems / i18n-0.4.2 /下找到了它lib / i18n / backend,我更改了它的权限。 But still it didn't work.
但是仍然没有用。
I copied the gems required by multi_json from /usr/local/lib/ruby to /multi_json/ruby. 我将multi_json所需的gems从/ usr / local / lib / ruby复制到了/ multi_json / ruby。 This seems to fix the gems errors, but I'm having the following error now:
这似乎可以解决gems错误,但是现在出现以下错误:
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. 我不明白为什么所有这些错误都在这里,以及为什么安装gem导致我的应用程序停止。 And I don't understand what the last error indicate.
而且我不明白最后一个错误表示什么。
Add to your Gemfile 添加到您的Gemfile
gem 'multi_json', '~> 1.11', '>= 1.11.2'
and then execute bundle install
. 然后执行
bundle install
。 There could be a problem with dependencies and not enough gems in your Gemfile. 依赖关系可能存在问题,并且Gemfile中的gem不够。
You have a lot of unnecessary gems, for fedena these are the gems you should have: 您有很多不必要的宝石,对于fedena,这些是您应该拥有的宝石:
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,并删除Gemfile和Gemfile.lock文件之外的multi_json文件夹,然后尝试以下命令:
gem install prawn -v 0.6.3
Hope it works. 希望它能工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.