Sass Loader Error: Invalid options object. Stylus Loader has been initialized using an options objec

报错信息

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 [email protected]

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 [email protected]

sass-loader版本 列表

总结:

这个错误主要 是 版本 问题,可能 太高,可能太低,导致 有些 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

猜你喜欢

转载自blog.csdn.net/weixin_44058725/article/details/122555173