Search code examples
javascriptnode.jsreactjsnpmnode-sass

Error: Node Sass version 8.0.0 is incompatible with ^4.0.0


When I start a React app with npm start, I got this error.How I fixed this error?

./src/App.scss (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--6-oneOf-5
-3!./node_modules/react-scripts/node_modules/sass-loader/dist/cjs.js??ref--6-oneOf-5-4!./src/App.scss)
Error: Node Sass version 8.0.0 is incompatible with ^4.0.0.

Here is the screenshot of error


Solution

  • Don't use node-sass anymore

    The module node-sass is now deprecated and replaced with a more robust new version which is sass. Only change the module and all would work fine. You can uninstall the old one and install the new one:

    npm uninstall node-sass
    npm install sass
    

    And all Works same !



    For those who want to use node-sass anyways

    To avoid the error, you can use the following table to install the appropriate version node-sass for your installed Node.js version which you can check by the command node --version.

    npm install node-sass@(your version)
    

    enter image description here