Home > Software engineering >  cannot load such file -- sassc running gem rails_admin with rails 7.0.4
cannot load such file -- sassc running gem rails_admin with rails 7.0.4

Time:11-20

I am having a problem with plain new project created with ruby on rails (ruby 3.1.2 and rails 7.0.4). After running rails new someprojectcommand project initialization finishing well. I can run project also I can add controller and it looks okay. My problem begins when adding rails_admin gem. Tried few versions latest one at this time 3.1 and also some preview versions and also 3.0.

After adding geminto Gemfile and running bundle command, also running rails g rails_admin:install finishing fine. After that when I trying to open http://locahost:3000/admin I am getting error:

LoadError in RailsAdmin::MainController#dashboard
cannot load such file -- sassc

if Bootsnap::LoadPathCache::FALLBACK_SCAN.equal?(resolved)
      if (cursor = Bootsnap::LoadPathCache.loaded_features_index.cursor(string_path))
        ret = require_without_bootsnap(path)
        resolved = Bootsnap::LoadPathCache.loaded_features_index.identify(string_path, cursor)
        Bootsnap::LoadPathCache.loaded_features_index.register(string_path, resolved)
        return ret

At first suggestions I tried to add gem "sassc-rails" but that produce another error:

SassC::SyntaxError in RailsAdmin::Main#dashboard

Error: File to import not found or unreadable: rails_admin/src/rails_admin/styles/base.
        on line 2:1 of app/assets/stylesheets/rails_admin.scss
>> @import "rails_admin/src/rails_admin/styles/base";

 $fa-font-path: ".";
@import "rails_admin/src/rails_admin/styles/base";

enter image description here enter image description here

Also, tried to add some net-http gem, tried to do update of the referencing path to this base directory in my app. But it just produce another error. Not so clean solution for this kind of problems, for now.

CodePudding user response:

I have solution, it looks like we must have already installed 'bootstrap'. So, if I create new rails 7 project with rails new someproject -j esbuild --css bootstrap and after that add the rails_admin gem and install it regularly.

My rails_admin 3.1 is accessible on /admin path and looks okay.

  • Related