在 Sage 上找不到与模式 .s?(c|a)ss" 匹配的文件

Pat*_*Pat 1 wordpress roots-sage yarnpkg

当我尝试在我的 Wordpress 5.5.3 主题中运行 Sage 9.0.10 并安装 Yarn 然后执行“yarn build”或“yarn start”时,我收到此错误:

PS C:\xampp\htdocs\patrick.visiegroep\wp-content\themes\visiegroep> yarn build
yarn run v1.22.5

$ webpack --progress --config resources/assets/build/webpack.config.js

Error: No files matching the pattern "C:\xampp\htdocs\patrick.visiegroep\wp-content\themes\visiegroep\resources\assets\**\*.s?(c|a)ss" were found.
    at C:\xampp\htdocs\patrick.visiegroep\wp-content\themes\visiegroep\node_modules\stylelint\lib\standalone.js:212:12
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
PS C:\xampp\htdocs\patrick.visiegroep\wp-content\themes\visiegroep>
Run Code Online (Sandbox Code Playgroud)

通过“构建”和“开始”,我总是得到

Error: No files matching the pattern "C:\xampp\htdocs\patrick.visiegroep\wp-content\themes\visiegroep\resources\assets\**\*.s?(c|a)ss"
Run Code Online (Sandbox Code Playgroud)

我找不到哪里出了问题,因为在我不得不核对我的整个 Wordpress 和 Sage 之前,它曾经可以工作。重新安装后出现这种情况。

小智 20

我遇到了同样的问题,我只更新了 3 个开发依赖项。我从 sage 9.0.9 拿走了它们,所以我更新了

"stylelint": "^13.7.2",
"stylelint-config-standard": "^20.0.0",
"stylelint-webpack-plugin": "^0.10.5",
Run Code Online (Sandbox Code Playgroud)

"stylelint": "^8.4.0",
"stylelint-config-standard": "~18.2.0",
"stylelint-webpack-plugin": "^0.10.5",
Run Code Online (Sandbox Code Playgroud)

当然删除旧的 node_modules 文件夹,并启动纱线。奇迹般有效。


小智 7

遇到了同样的问题,好几个星期都找不到答案。StyleLintPlugin 有问题。我所做的是这样的:

  • 在 theme-name/resources/assets/build 中打开 webpack.config.js 文件
  • Ctrl + F 表示“StyleLintPlugin”
  • 注释掉这段代码

new StyleLintPlugin({
  failOnError: !config.enabled.watcher,
  syntax: "scss",
})
Run Code Online (Sandbox Code Playgroud)

我不认为这是最好的选择,但它对我有用。如果其他人有更好的,请告诉我们。