如何确保 node-sass 和 sass-loader 版本兼容?

7

我的 Node.js 版本是 v16.16.0,npm 版本是 8.11.0。

enter image description here

但还是不断出现错误:

enter image description here

是否有任何方法可以升级 sass-loader? (同时,运行 npm run serve 时遇到此错误:

Syntax Error: Error: Node Sass version 7.0.1 is incompatible with ^4.0.0.)


1
完全不使用(已弃用的)node-sass吗? - jonrsharpe
换句话说,@jonrsharpe 的意思是:npm uninstall node-sass; npm install --save-dev sass,然后你就可以了。 - AKX
2个回答

7

不要使用node-sass

node-sass已经被弃用。因此,您需要使用新版本,即sass

您可以这样做来修复与node-sass相关的所有兼容性错误

npm uninstall node-sass
npm install sass

1
非常感谢。对我来说效果很好。 - sandalwoodsh

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接