Node Sass v7.0.0 incompatible ^4.0.0 || ^5.0.0 || ^6.0.0 – Code Example

Total
0
Shares

Node throws the error Sass version 7.0.0 is incompatible with ^4.0.0 || ^5.0.0 || ^6.0.0 because node-sass is deprecated. Use sass instead of node-sass.

Solution with Code Example

1. Use Sass

First of all remove node-sass and sass-loader (if installed) from your project –

# Using yarn
yarn remove node-sass
yarn remove sass-loader

# Using npm
npm uninstall node-sass
npm uninstall sass-loader

Then, install sass and sass-loader

# Using yarn
yarn add -D sass
yarn add sass-loader

# Using npm
npm i -D sass
npm i sass-loader

2. Use sass alias for node-sass

There are situations when removing node-sass is not an option. For example, different dependencies in your project could be using node-sass and you are forced to keep the compatibility. So, you can use alias for node-sass pointing to sass.

To implement it, open package.json and add it –

"node-sass": "npm:[email protected]^1.49.9",