Sass Loader Error: Invalid options object. Stylus Loader has been initialized using an options object that does not match the API schema

Sass Loader Error: Invalid options object. Stylus Loader has been initialized using an options object that does not match the API schema

我在 运行ning npm 运行 服务后收到此错误:

in ./src/components/site-checker/insert-model.vue?vue&type=style&index=0&lang=stylus&

Syntax Error: ValidationError: Invalid options object. Stylus Loader has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'preferPathResolver'. These properties are valid:
   object { stylusOptions?, sourceMap?, webpackImporter?, additionalData? }

我在这个框架中使用 VueJS:

[Vue 2] babel, router, vuex Vue CLI v4.5.8

这是最近 stylus-loadervue-cli 之间的兼容性问题的结果。最近 fixed 在 Vue 的开发分支中。

目前最好的办法是将 stylus-loader 降级到版本 3

npm install stylus-loader@3

您也可以尝试将 vue-cli 升级到最新版本:

npm update -g @vue/cli

OR

yarn global upgrade --latest @vue/cli