1

当我尝试在我的 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>

我总是用“构建”和“开始”

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

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

4

3 回答 3

23

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

"stylelint": "^13.7.2",
"stylelint-config-standard": "^20.0.0",
"stylelint-webpack-plugin": "^0.10.5",

"stylelint": "^8.4.0",
"stylelint-config-standard": "~18.2.0",
"stylelint-webpack-plugin": "^0.10.5",

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

于 2020-11-24T12:57:50.683 回答
9

遇到同样的问题,几周都找不到答案。StyleLintPlugin 有问题。我所做的是:

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

new StyleLintPlugin({
  failOnError: !config.enabled.watcher,
  syntax: "scss",
})

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

于 2020-11-23T09:49:38.533 回答
1

最新版本的 Sage 也发生在我身上。无论如何都无法让它运行。最终在我的package.json

"devDependencies": {
    "autoprefixer": "~8.2.0",
    "browser-sync": "~2.24.7",
    "browsersync-webpack-plugin": "^0.6.0",
    "bs-html-injector": "~3.0",
    "buble-loader": "^0.4.1",
    "cache-loader": "~1.2.5",
    "clean-webpack-plugin": "^0.1.18",
    "copy-globs-webpack-plugin": "^0.2.0",
    "cross-env": "^7.0.2",
    "css-loader": "^0.28.9",
    "cssnano": "~4.0.5",
    "eslint": "~4.19.1",
    "eslint-loader": "~1.9",
    "eslint-plugin-import": "~2.14.0",
    "extract-text-webpack-plugin": "~3.0.2",
    "file-loader": "^1.1.6",
    "friendly-errors-webpack-plugin": "^1.6.1",
    "imagemin-mozjpeg": "~7.0.0",
    "imagemin-webpack-plugin": "~2.2.0",
    "import-glob": "~1.5",
    "node-sass": "~4.9.4",
    "postcss-loader": "~2.1.0",
    "postcss-safe-parser": "~3.0",
    "resolve-url-loader": "~2.3.1",
    "rimraf": "~2.6",
    "sass-loader": "~6.0",
    "style-loader": "^0.22.1",
    "stylelint": "^8.4.0",
    "stylelint-config-standard": "~18.2.0",
    "stylelint-webpack-plugin": "^0.10.5",
    "uglifyjs-webpack-plugin": "^1.3.0",
    "url-loader": "^0.6.2",
    "webpack": "~3.10.0",
    "webpack-assets-manifest": "^1.0.0",
    "webpack-dev-middleware": "~2.0.4",
    "webpack-hot-middleware": "~2.22.3",
    "webpack-merge": "~4.1.4",
    "yargs": "~11.0.0"
  },

使用节点版本8.11.3,然后执行全新安装

  • 消除package-lock.json
  • 消除node_modules
  • 然后npm install

然后它终于奏效了!

如果您在 Windows 上运行并出现错误Python2 not found in PATH

  • 打开具有管理权限的 powershell
  • 运行npm install --global windows-build-tools(它将轻松安装python)
  • 然后重复上面的过程

祝你好运!

于 2020-11-24T06:21:13.543 回答