You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Stencil CLI + SASS partial引入报错:文件不存在,跨系统兼容问题求助

Fix: "Stencil CLI + SASS partial includes: file doesn't exist" on Windows

Hey there, this cross-platform issue (working on Mac but failing on Windows) almost always boils down to filesystem case sensitivity differences or Windows-specific path parsing quirks with Stencil CLI. Let’s walk through the most likely fixes:

1. Double-check filename/path case consistency

Mac’s default filesystems (APFS/HFS+) are case-insensitive, so your colleague’s Mac can resolve ./layout/_pdp.scss even if the actual file is named _PDP.scss or _PdP.scss. But Windows’ NTFS is case-sensitive by default (and Stencil CLI’s parser tends to respect that strictly):

  • Navigate to your project’s layout folder and verify the exact filename matches what’s in your import statement—including the leading underscore and lowercase pdp.
  • If there’s any case mismatch, rename the file to exactly match your import (e.g., if your import uses _pdp.scss, make sure the file isn’t _PDP.scss).

2. Tweak your SASS import syntax for Windows compatibility

Stencil CLI can handle path parsing differently on Windows, so try these adjustments to your import line:

  • Stick with forward slashes (/) as path separators—never use Windows-style backslashes (\). For example, use @import './layout/_pdp.scss'; instead of .\\layout\\_pdp.scss.
  • Leverage SASS’s default partial rules: omit the leading underscore and file extension, so write @import './layout/pdp';—SASS will automatically look for _pdp.scss.

3. Clear Stencil’s cache and restart the service

Cached path data can sometimes cause weird resolution issues. Here’s how to reset it:

  • Stop your running stencil start process with Ctrl+C.
  • Delete Stencil’s cache folder on Windows: paste %LOCALAPPDATA%\stencil-cli into File Explorer’s address bar, then delete all contents inside.
  • Restart the service with stencil start and test your local site again.

4. Enable case sensitivity for your project directory (Windows-specific)

If your Windows setup has case-insensitivity enabled for the drive (some newer Windows versions allow this), it might conflict with Stencil’s parsing. Fix it with this command:

  • Open Command Prompt, navigate to your project’s root directory.
  • Run fsutil file setcasesensitiveinfo . enable to turn on case sensitivity for the project folder.
  • Restart stencil start and check if the error is gone.

If none of these work, sharing the exact SCSS import line that’s throwing the error would help narrow things down further. But given the cross-platform behavior you’re seeing, the first two fixes should resolve the issue for most cases.

内容的提问来源于stack exchange,提问作者Tyler V.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:34:17