Jekyll::Converters::Scss encountered an error

I’m getting an error when running jekyll serve:

 Conversion error: Jekyll::Converters::Scss encountered an error while converting 'assets/css/site.scss':
                    Error: File to import not found or unreadable: base. on line 2:1 of site.scss >> @import "base"; ^ 
             Error: Error: File to import not found or unreadable: base. on line 2:1 of site.scss >> @import "base"; ^ 
             Error: Run jekyll build --trace for more information.

But the only thing wrong is that it won’t add the line for the sourcemap url to the bottom of the combined css file. The same number of lines is there, it is finding and importing the partial.

If I just save the partial there is a 50-50 chance I get the error. I have about a dozen partials and it doesn’t matter which one I do it to, they all do the same thing.

Not really a big deal, but a little odd.

I am on windows. jekyll 4.2

I used to do sass outside of jekyll but am now letting jekyll handle it again, so I don’t know if this just started happening or not.

here is a longer bit of the output, this is just me pressing ctrl +s - not even changing anything.

Regenerating: 1 file(s) changed at 2021-03-04 20:03:52
                    _sass/_variables.scss
                    ...done in 0.0730343 seconds.

      Regenerating: 1 file(s) changed at 2021-03-04 20:03:53
                    _sass/_variables.scss
                    ...done in 0.0731719 seconds.

      Regenerating: 1 file(s) changed at 2021-03-04 20:03:54
                    _sass/_variables.scss
  Conversion error: Jekyll::Converters::Scss encountered an error while converting 'assets/css/site.scss':
                    Error: File to import not found or unreadable: variables. on line 1:1 of site.scss >> @import "variables"; ^ 
             Error: Error: File to import not found or unreadable: variables. on line 1:1 of site.scss >> @import "variables"; ^ 
             Error: Run jekyll build --trace for more information.

      Regenerating: 1 file(s) changed at 2021-03-04 20:03:54
                    _sass/_variables.scss
                    ...done in 0.0680597 seconds.

      Regenerating: 1 file(s) changed at 2021-03-04 20:04:00
                    _sass/_variables.scss
  Conversion error: Jekyll::Converters::Scss encountered an error while converting 'assets/css/site.scss':
                    Error: File to import not found or unreadable: variables. on line 1:1 of site.scss >> @import "variables"; ^ 
             Error: Error: File to import not found or unreadable: variables. on line 1:1 of site.scss >> @import "variables"; ^ 
             Error: Run jekyll build --trace for more information.

      Regenerating: 1 file(s) changed at 2021-03-04 20:04:00
                    _sass/_variables.scss
                    ...done in 0.0667192 seconds.

      Regenerating: 1 file(s) changed at 2021-03-04 20:04:01
                    _sass/_variables.scss
                    ...done in 0.0742887 seconds.

It is also failing to create the sourcemap file. So if I get the error there is no site.css.map file, if I don’t get the error there is.

I do have a blazing fast computer, it is sort of like it is trying to do the map before it is done creating the file?

Ah, the joys of intermittent errors and race conditions and async tasks.

Maybe it is a Jekyll bug where ordering is not enforced, but let’s see if your code can be improved first.

Can you share a link?

Your error says this import cannot be found

@import "base";

Is the file definitely there? Is it your file? Is it in a theme?

Maybe you need to reorder your imports.

I use Minima as a reference. The minima.scss file has imports at the bottom after setting variables.

And this is how you load that in a repo using the theme

the one at the top says base, then below that I put some more - on those I clicked on the variables one and that is what those say. Which ever partial I am on is the one it says it can’t find, but it can find it and process it, it is all there (except the map).

It is not a theme, just regular sass, imported from assets/css/site.scss like so:

---
---
@import "variables";
@import "base";
@import "container";
@import "nav";
@import "tables";
@import "buttons";
@import "flexbox-home";
@import "gallery";
@import "footer";
@import "owl-slider";
@import "helpers";
@import "panel";
@import "order-now";
@import "custom-styles";

this repo does it for me:

this is the base site I made a few years ago, delete the gem and gem lock file and ignore the package json file. Then do jekyll s and go to the sass folder and open a file and press save a few times, it started out ok the first several times and then it started erroring.