Windows环境Jekyll serve转换报错:No such file or directory
Hey there, let's tackle that frustrating Sass cache error you're hitting when running bundle exec jekyll serve on Windows. This issue usually pops up due to corrupted cache files, Windows path quirks, or permission restrictions—here's how to fix it step by step:
1. Delete the Corrupted .sass-cache Directory
The error points to a missing file in the .sass-cache folder, which means your cache is likely corrupted. Let's wipe it clean and let Jekyll rebuild it from scratch:
- Using File Explorer: Enable hidden files (go to View → Show → Hidden items), locate the
.sass-cachefolder in your Jekyll site directory, and delete it. - Using Command Prompt: Run this command in your site directory:
rmdir /s /q .sass-cache - Using PowerShell:
Remove-Item -Recurse -Force .sass-cache
After deleting, re-run bundle exec jekyll serve—this should let Jekyll generate a fresh, working cache.
2. Check Folder Permissions
Windows sometimes restricts write access to folders, which can prevent Jekyll from creating or accessing cache files. Here's how to fix permissions:
- Right-click your Jekyll site folder → Properties → Security tab.
- Click Edit → Add, type your username, then click Check Names to select your account.
- Grant your user account Full Control permissions, then click Apply and OK.
3. Disable Sass Cache (As a Workaround)
If deleting the cache doesn't resolve the issue, you can disable the Sass cache entirely to bypass the problem. Add this configuration to your _config.yml file:
sass: cache: false
This makes Jekyll compile SCSS files from scratch every time (slightly slower, but eliminates cache-related errors).
4. Update Dependencies
Outdated versions of jekyll-sass-converter or rouge might be causing compatibility issues. Run this command to update them:
bundle update jekyll-sass-converter rouge
Once updated, try starting the server again with bundle exec jekyll serve.
After trying these steps, your Jekyll site should build and serve without that annoying Sass cache error.
内容的提问来源于stack exchange,提问作者Martin Morrey

