vue-cli 选择Default(vue 2)。安装less和less-loader报错。Syntax Error: TypeError: this.getOptions is not a function

npm i --save-dev less less-loader

ERROR Failed to compile with 1 error 下午3:26:32

error in ./src/App.vue?vue&type=style&index=0&lang=less&

Syntax Error: TypeError: this.getOptions is not a function


@ ./node_modules/vue-style-loader??ref--10-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--10-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--10-oneOf-1-2!./node_modules/less-loader/dist/cjs.js??ref--10-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=style&index=0&lang=less& 4:14-419 15:3-20:5 16:22-427
@ ./src/App.vue?vue&type=style&index=0&lang=less&
@ ./src/App.vue
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://10.15.239.147:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

 

 

 

 

 

【原因】less-loader的版本过高导致

【解决】安装低版本

npm i --save-dev less@3.10.3
npm i --save-dev less-loader@5.0.0

 

posted @ 2021-04-23 13:31  Cynthia娆墨旧染  阅读(1125)  评论(0编辑  收藏  举报