Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'node-sass' usage is deprecated and will be removed in a future major version

Tags:

angular

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

like image 556
fatmaaGomaa Avatar asked Jan 06 '21 10:01

fatmaaGomaa


People also ask

Is node Sass deprecated?

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.

What replaces node sass?

Sass, Webpack, PostCSS, Compass, and Animate. css are the most popular alternatives and competitors to node-sass.

What is the node Sass version for node 14?

Nodejs v14 Support added with node-sass 4.14.

Is 'node-Sass' deprecated?

'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.

How to remove the 'node-Sass' usage in Node JS?

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'.

What happened to '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.

How do I stop using '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'.


4 Answers

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.

like image 155
Ahmed Shehatah Avatar answered Oct 17 '22 12:10

Ahmed Shehatah


Try replacing 'node-sass' with 'sass'

npm uninstall node-sass
npm i -S sass
like image 21
jie Avatar answered Oct 17 '22 10:10

jie


$ 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)
like image 8
Jiban Singh Avatar answered Oct 17 '22 12:10

Jiban Singh


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.

like image 4
David Avatar answered Oct 17 '22 11:10

David