Mas*_* SB 4 ruby ruby-on-rails sass
我有一个使用 tailwind css 创建的 Rails 7 应用程序。自定义字体在生产中不起作用,因此我添加了 gem Rails-sassc 并将 application.css 转换为 .scss。最终恢复了更改,但现在在本地我得到了
“无法加载此类文件——sassc”
我已经删除了 gem,删除了 gemfile.lock,检查了 gem 信息,但仍然遇到相同的错误。我什至尝试回滚到较早的提交。
还尝试添加
config.assets.css_compressor = nil到我的 application.rb
在回溯中,我看到有对sprockets (4.0.3) lib/sprockets/autoload/sassc.rb:2:in “我认为这是我本地的东西”的引用,但不确定如何删除它。任何帮助,将不胜感激。
日志的开头
Rendered layout layouts/application.html.erb (Duration: 27.7ms | Allocations: 37919)
Completed 500 Internal Server Error in 32ms (ActiveRecord: 0.0ms | Allocations: 41345)
LoadError (cannot load such file -- sassc):
bootsnap (1.12.0) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in `require'
bootsnap (1.12.0) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:15:in `require'
zeitwerk (2.5.4) lib/zeitwerk/kernel.rb:35:in `require'
sprockets (4.0.3) lib/sprockets/autoload/sassc.rb:2:in `<main>'
bootsnap (1.12.0) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
bootsnap (1.12.0) lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
zeitwerk (2.5.4) lib/zeitwerk/kernel.rb:35:in `require'
sprockets (4.0.3) lib/sprockets/sassc_processor.rb:42:in `initialize'
sprockets (4.0.3) lib/sprockets/sassc_processor.rb:27:in `new'
sprockets (4.0.3) lib/sprockets/sassc_processor.rb:27:in `instance'
Run Code Online (Sandbox Code Playgroud)
希望没有人犯和我一样的错误......
解决方案:
rails tmp:clear
Run Code Online (Sandbox Code Playgroud)
来源:资产:预编译导致 LoadError:无法加载此类文件 - sassc