When trying to precompile Rails assets for production mode, the following error may appear:
$ RAILS_ENV=production rails assets:precompile Error: File to import not found or unreadable: main. on line 62:1 of stdin >> @import "main"
This can occur when using a Sass import with the originally generated
In this case the issue is the file extension–it simply needs to be renamed with an
.scss extension, and the asset precompilation should then work as expected:
$ mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss $ RAILS_ENV=production rails assets:precompile (yarn install output) ✨ Done in 10.95s. Everything's up-to-date. Nothing to do