Sass Loader错误:选项对象无效.Stylus Loader已使用与API架构不匹配的选项对象进行初始化



我在运行npm run serve:后收到此错误

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,路由器,vuexVue CLI 4.5.8版

这是stylus-loadervue-cli之间最近出现兼容性问题的结果。它最近在Vue的开发分支中得到了修复。

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

npm install stylus-loader@3

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

npm更新-g@vue/cli

纱线全球升级--最新的@vue/cli

最新更新