JudahSan / medimartxpress

0 stars 0 forks source link

LoadError in Admin::CategoriesController#index - Missing libvips Library #8

Open JudahSan opened 3 months ago

JudahSan commented 3 months ago

Description

Problem: I encountered an error when trying to view product categories in the admin panel.

Expected Behavior: The categories page should display product categories including their name, description, and image.

Actual Behavior: An error occurs when trying to load the categories page:

LoadError in Admin::CategoriesController#index
Could not open library 'vips.so.42': vips.so.42: cannot open shared object file: No such file or directory.
Could not open library 'libvips.so.42': libvips.so.42: cannot open shared object file: No such file or directory.
Searched in <system library path>, /usr/lib, /usr/local/lib, /opt/local/lib

Environment:

Steps to reproduce:

  1. Navigate to admin
  2. Click on "Categories" to view the list of product categories. (add a category if category is empty)
  3. The error appears instead of the categories list.

Extracted Source (category.rb model file)

class Category < ApplicationRecord

  has_one_attached :image

  has_many :products
  def image_as_thumbnail
    image.variant(resize_to_limit: [50, 50]).processed
  end

end
JudahSan commented 3 months ago

Fix: Install the libvips library, which is required for image processing:

sudo apt-get install libvips42