Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-sass v5.0.0 compilation error #9986

Closed
nhevia opened this issue Nov 2, 2020 · 9 comments · Fixed by #9988
Closed

node-sass v5.0.0 compilation error #9986

nhevia opened this issue Nov 2, 2020 · 9 comments · Fixed by #9988

Comments

@nhevia
Copy link

nhevia commented Nov 2, 2020

Describe the bug

Installing node-sass as recommended in the documentation to have SASS support returns following error on compilation:

Error: Node Sass version 5.0.0 is incompatible with ^4.0.0

sass-loader was updated to v10.0.5 for supporting node-sass v5.0.0 (webpack-contrib/sass-loader#899), but react-scripts is pinned to sass-loader 8.0.0. This means that every fresh installation (or update) which is using node-sass will end up with this error on yarn/npm start.

Related issue threads:
https://stackoverflow.com/a/64626556/6402990
webpack-contrib/sass-loader#898

Did you try recovering your dependencies?

Not applicable

Which terms did you search for in User Guide?

Not applicable

Environment

All

Steps to reproduce

  1. npx create-react-app sass-error-compilation
  2. cd sass-error-compilation
  3. yarn add node-sass
  4. Modify App.css to App.scss. Change extension in App.js as well.
  5. yarn start

Expected behavior

Scss files compiled to css without sass-loader returning an error.

Actual behavior

Failed to compile.

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

Reproducible demo

@nhevia
Copy link
Author

nhevia commented Nov 2, 2020

It might be a good time to move to sass (dart implementation) instead of libsass/node-sass.

@cduff
Copy link

cduff commented Nov 12, 2020

It might be a good time to move to sass (dart implementation) instead of libsass/node-sass.

Further to the above, also note that node-sass has been deprecated.

I followed this suggestion and simply replaced node-sass with sass and everything seems to be working fine without any other changes required.

npm uninstall node-sass
npm i sass

@iamkennis
Copy link

iamkennis commented Nov 12, 2020

how i resolve this issues :

  1. I update my computer node version to 14
  2. And download the Supported node-sass version check here for your computer supported node version

@Powersource
Copy link

Does this essentially mean that CRA doesn't support node 15?

@nhevia
Copy link
Author

nhevia commented Nov 25, 2020

I followed this suggestion and simply replaced node-sass with sass and everything seems to be working fine without any other changes required.

npm uninstall node-sass
npm i sass

Be careful with that approach #10045

@errorsolve
Copy link

This Error Solved By All Possible Solution In This Article At Here Error: Node Sass version 5.0.0 is incompatible with ^4.0.0

@sunvodz
Copy link

sunvodz commented Oct 15, 2021

Install node-sass: yarn add node-sass
Convert your .css files to .scss
Convert your import file.scss

if not work
1.yarn remove node-sass
2.yarn add [email protected]

@piyas33
Copy link

piyas33 commented May 29, 2022

Type the following command:

npm rebuild node-sass

I hope its works.

@SeyfCHERNI
Copy link

npm add node-sass --force works good :D 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants