Ruby on Rails 7: Fixing Sass issue with libsass.so
Hello friends!
I’ve had an on again, off again relationship with Ruby and Ruby on Rails for years. Ruby and Rails are some of the tools that helped me get into web development, and now I’m making a small book review app with Rails
I was very pleased to see that it was very easy to make Rails throw together a few web pages for me based on a simple data model: books can have many reviews, and reviews can have many comments. Passing this info to rails g scaffold
gave me instant results, though they needed some tweaking to make the front-end more in line with what the user would expect
I’m using SimpleCSS to just get some very barebones CSS going, and it’s working very well for me. On the topic of CSS, though, and probably why you clicked on this article, I encountered this error message when trying to run my app with rails s
on a Fedora distribution called Nobarar recently:
Could not open library '/home/spacey/rubyreads/vendor/bundle/ruby/3.2.0/gems/sassc-2.4.0/lib/sassc/libsass.so':
/home/user/rubyreads/vendor/bundle/ruby/3.2.0/gems/sassc-2.4.0/lib/sassc/libsass.so:
cannot open shared object file: No such file or directory. (LoadError)
Searched in <system library path>, /usr/lib, /usr/local/lib, /opt/local/lib
This definitely caused me some issues for a while. I remembered I had solved similar issues in the past, like with Rails not being able to find libyaml
, with a pleasingly simple sudo dnf install libyaml libyaml-devel
. I tried a similar approach this time, even following this handy guide on the Fedora Developer Portal, but I kept on getting exactly the same error
Eventually, I removed this line from my Gemfile:
gem "sassc-rails"
and running the Rails web server with `rails s` worked again!