Home > Software engineering >  ./bin/rails css:install:bootstrap fails
./bin/rails css:install:bootstrap fails

Time:09-18

./bin/rails css:install:bootstrap is failing.

rails aborted!
NoMethodError: undefined method `assets' for #<Rails::Application::Configuration:0x000000010afa4118 @root=#<Pathname:~/Documents/rails_project>

What is going on.

I've had trouble running commands like this with spaces in the path, but I don't have spaces in this case.

CodePudding user response:

config.assets comes from asset pipeline:

sprockets-rails
https://github.com/rails/sprockets-rails/blob/v3.4.2/lib/sprockets/railtie.rb#L99

or propshaft
https://github.com/rails/propshaft/blob/v0.6.4/lib/propshaft/railtie.rb#L6

There was config.assets in rails itself, but it was removed in rails 5.

In rails 6 and before, sprockets-rails was a dependency so you would get config.assets automatically.

In rails 7 sprockets-rails became optional and you must have gem "sprockets-rails" or gem "propshaft" in your Gemfile.


https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#sprockets-is-now-an-optional-dependency

  • Related