gpt4 book ai didi

ruby-on-rails - rails 在生产服务器中包含 CarrierWave::RMagick 错误

转载 作者:太空宇宙 更新时间:2023-11-03 16:51:55 24 4
gpt4 key购买 nike

我想使用带有载波的 rmagick gem 来上传和调整图像大小。

在我的 Local Rails 中..它运行良好。但是当部署到服务器时.. 不起作用..

不知道为什么T^T

这里是 unicorn_error_log..

.../shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require': No such file to load -- RMagick (LoadError)
from .../shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
from .../shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from .../shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from .../shared/bundle/ruby/2.0.0/gems/carrierwave-0.9.0/lib/carrierwave/processing/rmagick.rb:67:in `rescue in block in <module:RMagick>'
from ...p/shared/bundle/ruby/2.0.0/gems/carrierwave-0.9.0/lib/carrierwave/processing/rmagick.rb:64:in `block in <module:RMagick>'
from .../shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/concern.rb:114:in `class_eval'
from .../shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/concern.rb:114:in `append_features'
from .../releases/20131018192701/app/uploaders/image_uploader.rb:5:in `include'
from .../releases/20131018192701/app/uploaders/image_uploader.rb:5:in `<class:ImageUploader>'
from .../releases/20131018192701/app/uploaders/image_uploader.rb:3:in `<top (required)>'

但奇怪的是在 server rails c 生产中

a = Word.find(2)
a.image.recreate_versions!(:image, :thumb)

这很好用,没有错误!!!thumb_~~.jpg ,生成调整大小的图像..

并在 server rails c 生产输入中

require 'RMagick'
=> false

这意味着 RMagick 已经在加载了,对吧?

啊!这是我的 image_uploader.rb

3: class ImageUploader < CarrierWave::Uploader::Base

5: include CarrierWave::RMagick

52: version :thumb do
53: process :resize_to_limit => [400, 400]
54: end

第 5 行错误!

作为引用,我已经在下面完成了..

apt-get install libmagickwand-dev imagemagick
in Gemfile | gem 'rmagick', :require => 'RMagick'

请帮帮我..为什么不在服务器上工作??

最佳答案

你是如何运行服务器的?

如果你的 Gemfile 有 rmagick 那么你需要使用 bundle exec 运行服务器

有时没有加载依赖项。 bundle exec 将确保始终加载依赖项。

关于ruby-on-rails - rails 在生产服务器中包含 CarrierWave::RMagick 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19457965/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com