问题描述
配置 Vue + Cesium 项目时出现问题如下
E:\CesiumProject\world>npm run serve
> world@0.1.0 serve
> vue-cli-service serve
INFO Starting development server...
98% after emitting CopyPlugin
ERROR Failed to compile with 1 error 下午4:50:46
error in ./src/views/Index.vue?vue&type=style&index=0&id=23543608&scoped=true&lang=scss
Syntax Error: TypeError: this.getOptions is not a function
@ ./node_modules/vue-style-loader??ref--9-oneOf-1-0!./node_modules/css-loader/dist/cjs.js??ref--9-oneOf-1-1!./node_modules/vue-loader-v16/dist/stylePostLoader.js!./node_modules/postcss-loader/src??ref--9-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--9-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader-v16/dist??ref--1-1!./src/views/Index.vue?vue&type=style&index=0&id=23543608&scoped=true&lang=scss 4:14-451 15:3-20:5 16:22-459
@ ./src/views/Index.vue?vue&type=style&index=0&id=23543608&scoped=true&lang=scss
@ ./src/views/Index.vue
@ ./src/router/index.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://192.xxx.xxx.xxx:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js
## 问题解决
先卸载现有版本的软件
```shell
E:\CesiumProject\world> npm uninstall sass-loader
E:\CesiumProject\world> npm uninstall node-sass
安装指定版本的包
E:\CesiumProject\world> npm i node-sass@4.14.1 --save-dev
E:\CesiumProject\world> npm i sass-loader@10.1.0 --save-dev
参考
参考了如下博客
[1]. VUE笔记:Failed to resolve loader: sass-loader https://www.cnblogs.com/chig/p/15364680.html
. . . . . .
桃花仙人种桃树,又摘桃花换酒钱_
|