使用uni-app安装uni-ui后npm run dev:mp-weixin 出现的报错

楚元章
2023-12-01

报错记录:

ERROR  Failed to compile with 1 error                                                                       下午3:16:46
 error  in ./node_modules/@dcloudio/uni-ui/lib/uni-badge/uni-badge.vue?vue&type=style&index=0&id=50168758&lang=scss&scoped=true&

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? }

 @ ./node_modules/@dcloudio/uni-ui/lib/uni-badge/uni-badge.vue?vue&type=style&index=0&id=50168758&lang=scss&scoped=true& 1:0-737 1:753-756 1:758-1492 1:758-1492
 @ ./node_modules/@dcloudio/uni-ui/lib/uni-badge/uni-badge.vue
 @ ./node_modules/babel-loader/lib!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--13-1!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./src/pages/home/index.vue?vue&type=script&lang=js&
 @ ./src/pages/home/index.vue?vue&type=script&lang=js&
 @ ./src/pages/home/index.vue
 @ ./src/main.js?{"page":"pages%2Fhome%2Findex"}

原因:

sass-loader的版本大于8以上就会报这个错,使用8.*以下的版本包括8.*

解决方法:

 npm i sass-loader@8.0.2 -s
 npm i node-sass -s

 类似资料: