When I upgraded from Angular 8 to 11 I faced this warning
'node-sass' usage is deprecated and will be removed in a future major version. To opt-out of the deprecated behavior and start using 'sass' uninstall 'node-sass'.
can anyone help me
Thanks in advance
Warning: LibSass and Node Sass are deprecated. While they will continue to receive maintenance releases indefinitely, there are no plans to add additional features or compatibility with any new CSS or Sass features. Projects that still use it should move onto Dart Sass.
Sass, Webpack, PostCSS, Compass, and Animate. css are the most popular alternatives and competitors to node-sass.
Nodejs v14 Support added with node-sass 4.14.
'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' Javascript queries related to “'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'. Code Example All Languages >> Javascript >> Node.js >> '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' 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'. Are there any code examples left? Node Sass version 6.0.1 is incompatible with ^4.0.0.
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'.
The full error message is
'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'.
So, I think the only solution that you can try is obvious, just uninstall node-sass.
=> I already uninstalled it and tried ng serve
and ng build --prod
all is working fine.
FYI, I as a developer always have found this library node-sass
as a pain in the head because of its incompatibility errors. I am happy that we don't have to use it and deal with its painful errors anymore.
Try replacing 'node-sass' with 'sass'
npm uninstall node-sass
npm i -S sass
$ npm uninstall node-sass
This will fix the following error also.
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)
After uninstalling I was still getting the same error.
I had a look at the source code, turns out the check is quite fragile:
try {
sassImplementation = require('node-sass');
wco.logger.warn(`'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'.`);
}
Which means that, if you have node-sass installed globally, or in a parent directory somewhere, you'll get this warning.
To test this, make a new file in your project directory and run it with node:
const t = require('node-sass');
console.log(t);
If you don't get module_not_found, it means it's node_sass is being resolved. In my case I had node-sass installed under my user home directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With