vue 使用scss报错

在Vue项目配置Webpack后,遇到Scss编译报错,错误提示涉及UnhandledPromiseRejectionWarning和DeprecationWarning。问题根源是兼容性问题,通过降级sass-loader和node-sass到合适版本来解决。完成依赖更新后,重新运行npm run dev,项目恢复正常。

vue 使用scss报错


安装sass-load和node-sass

npm install sass-loader --save-dev  
npm install node-sass --save

将vue样式改为scss
在webpack.base.conf.js中配置好了
在这里插入图片描述
然后发现报错了
报错
(node:2532) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either byrRunner.js:119:14) throwing inside of an async function without a catch block, or by rejecting a promise which was not handlunner.js:120:4)ed with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandoaderRunner.js:232:2)led-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) m.js:70:14
(node:2532) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, prom throwing inside of an async function without a catch block, or by rejecting a promise which was not handledise rejections that are not handled will terminate the Node.js process with a non-zero exit code. d-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
34% building modules 208/209 modules 1 active …tasay-user-center\src\layout\Home.vue

上网查询后发现是兼容性问题

安装低版本的sass-load和node-sass即可

npm install sass-loader@7.3.1 --save-dev  
npm install node-sass@4.0.0 --save

再次npm run dev即可
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值