I met the same problem.
to solve it, the key is find what is the content of "stdin", so we have to modify your local gem file and add debug outputs:
# edit (/home/siwei/.asdf/installs/ruby/3.0.4/lib/ruby/gems/3.0.0/gems/sassc-rails-2.1.2/lib/sassc/rails/compressor.rb)
def call(*args)
input = if defined?(data)
data # sprockets 2.x
else
args[0][:data] #sprockets 3.x
end
# add these debug lines of code
puts "=== input is: "
File.write('/tmp/temp_scss', input)
puts "=== input end "
SassC::Engine.new(
input,
{
style: :compressed
}
).render
end
then run command:
RAILS_ENV=production bundle exec rails assets:precompile
then you will meet error, no worry, check out the file /tmp/temp_scss
, find the "line 17881 of stdin", you will find the syntax error.
e.g. my error looks like: