“node-sass”用法已弃用,将在未来的主要版本中删除

当我从 Angular 8升级到11 时,我遇到了这个警告

'node-sass' 用法已弃用,并将在未来的主要版本中删除。要选择退出已弃用的行为并开始使用“sass”,请卸载“node-sass”。

任何人都可以帮助我
在此先感谢

回答

完整的错误信息是

'node-sass' usage is deprecated and will be removed in a future major version. To opt-out of the deprecated behaviour and start using 'sass' uninstall 'node-sass'.

因此,我认为您可以尝试的唯一解决方案是显而易见的,只需卸载 node-sass。

=> 我已经卸载它并尝试过ng serveng build --prod一切正常。

仅供参考,作为一名开发人员,我总是发现这个库node-sass令人头疼,因为它的不兼容错误。我很高兴我们不必再使用它并处理其痛苦的错误。

  • Are you using sass in your project? Because uninstalling node-sass and not doing anything else is not enough.
  • Yes sir I am using scss files inside my apps and it is working fine.

回答

$ npm uninstall node-sass

这也将修复以下错误。

Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/resolve-url-loader/index.js):
Error: resolve-url-loader: CSS error
  source-map information is not available at url() declaration (found orphan CR, try removeCR option)


以上是“node-sass”用法已弃用,将在未来的主要版本中删除的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>