报错信息
1.Sass Loader Error: Invalid options object. Stylus Loader has been initialized using an options object that does not match the API schema。
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? }
解决方案:
主要 看 报错的插件名(蓝色的)。
npm uninstall stylus-loader
然后
npm install stylus-loader@3.0.0
stylus-loader 版本 列表https://www.npmjs.com/package/https://www.npmjs.com/package/stylus-loader
2.Syntax Error: ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
Syntax Error: ValidationError: Invalid options object. Sass Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'additionalData'. These properties are valid:
object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter?, nvue? }
解决方案:
npm uninstall lass-loader
npm install sass-loader@7.2.0
总结:
这个错误主要 是 版本 问题,可能 太高,可能太低,导致 有些 api 不兼容 ,所以 需要 对照 版本表来 确定版本。
options has an unknown property 'additionalData'. 这个就是不兼容的属性 api ,去 版本列表看看是否有这个属性,有的话 就切换到 该版本。
例如:sass-loader
有这个 api 就可以试着 切换到此版本
sass-loader 12.4.0https://www.npmjs.com/package/sass-loader/v/12.4.0