score:1119
tl;dr
npm uninstall node-sass
npm install sass
or, if using yarn
yarn remove node-sass
yarn add sass
edit3: yes, another edit. moving to sass (dart-sass) is the best solution. previous one included locking node-sass to version 4.x.x, which is 2 years old and lacks newer scss features.
edit2: sass-loader v10.0.5 fixes it. the problem is you might not be using it as a project dependency, but more as a dependency of your dependencies. cra uses a fixed version, angular-cli locks to node-sass v4, and so on.
the recommendation for now is: if you're installing just node-sass, check the below workaround (and the note). if you're working on a blank project and you can manage your webpack configuration (not using cra or a cli to scaffold your project), install the latest sass-loader.
edit: this error comes from sass-loader. there is a semantic versioning mismatch since node-sass @latest is v5.0.0 and sass-loader expects ^4.0.0.
there is an open issue on their repository with an associated fix that needs to be reviewed. until then, refer to the solution below.
workaround: don't install node-sass 5.0.0 yet (the major version was just bumped).
uninstall node-sass
npm uninstall node-sass
then install the latest version (before 5.0)
npm install node-sass@4.14.1
note: libsass (hence node-sass as well) is deprecated and dart-sass is the recommended implementation. you can use sass
instead, which is a node.js distribution of dart-sass compiled to pure javascript.
score:-3
steps to resolve this issue:
go to your node_module folder and open node-sass modules.
in the package.json file inside node-sass, change the version from "5.0.0" to "4.14.1".
finally in the package.json at the root of the main project again change node-sass version from "5.0.0" to "4.14.4."
this should work.
score:0
in app.js or wherever the css is being imported, make sure to import css and not scss. the script in package.json will create a css file and that's what should be imported.
"scss": "node-sass --watch -include-path src/scss -o src/css"
this script will watch a scss file inside of a folder called scss that is inside src. it will then create an css folder inside src and add a css file inside that folder, this is the file you should import in app.js
to run the script:
npm run scss
file structure example:
src/scss/styles.scss
css file created by script:
src/css/styles.css
score:0
or else rebuild your node-sass so that the compatibility does not produce an error. when the incompatibility between node-sass and node occurs, you will get typescript errors . do this to achieve node-sass compatibility.
npm rebuild node-sass
score:0
this error is due to an incompatible version of the sass loader with node-sass.
add these dependencies at the end of your package.json file.
note: you can google to check which sass-loader version is compatible with your node-sass version.
"devdependencies": { "node-sass": "^6.0.1", "sass-loader": "^10.2.0" }
score:0
updated answer
please note node sass is depreciated and you may replace it by dart sass:
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.
source: https://www.npmjs.com/package/node-sass
the below recipe helped me:
- uninstall
node-sass
:- npm:
npm uninstall node-sass
- yarn:
yarn remove node-sass
- npm:
- uninstall
sass-loader
:- npm:
npm uninstall sass-loader
- yarn:
yarn remove sass-loader
- npm:
- install dart sass as a development dependency
- npm:
npm install sass -dev
- yarn:
yarn add sass -dev
- npm:
before build, you should also:
- remove
node_modules
directory - remove lock file:
- npm: remove
package-lock.json
- yarn: remove
yarn.json
- npm: remove
score:1
small update: in case if you get the below error in regard to node-sass, follow the steps given below.
code eperm npm err! syscall unlink
steps to solve the issue:
- close visual studio
- manually remove .node-sass.delete from node_modules
- open visual studio
npm cache verify
npm install node-sass@4.14.1
score:1
just change version to: "version": "4.14.1" in your package.json file
score:1
adding sass-loader as as dev-dependency solved this for me. "devdependencies": { "node-sass": "^6.0.0", "sass-loader": "^11.1.1" }
score:1
delete a yarn.lock file in the project and
yarn remove node-sass
yarn add node-sass
score:2
if the error is
error: node sass version 5.0.0 is incompatible with ^4.0.0
step1: stop the server
step2: run commands are npm uninstall node-sass
step3: check node-sass in package.json
if node-sass is available in the file then again run step2.
step4: npm install node-sass@4.14.1
<=== run command
step5: wait until the command successfully runs.
step6: start-server using npm start
score:2
i met the same issue, and here's how i was able to fix it:
firstly, you have to know which node-sass
version you are using in your project. then go upgrade or downgrade your current node.js version to the compatible version with your current node-sass
version, you can know that from this link.
of course, stop the server, and close your ide.
so, the best way to upgrade or downgrade the node.js version, has mentioned above in this answer. then remove the node_modules
, and package-lock.json
and install again... you can do it as such:
npm cache clean --force
rm -rf /node_modules package-lock.json
npm install
npm audit fix
npm run <your_script_name>
score:2
you can just switch to sass since node-sass is deprecated now anyway
in your package.json
"node-sass": "npm:sass@^1.49.9",
react still asks for node-sass after removing it and replacing with sass so you can alias it like this and now react will use sass
score:4
it worked for me after adding particular version of node-sass package (node-sass@4.14.1)
score:4
according to the edit2 of nicolas hevia telling that
sass-loader v10.0.5 fixes it
i launched this command:
npm install sass-loader@^10.0.5 node-sass --save-dev
that fixed my issue.
be aware that i am in a development environment. in other cases, the option --save-dev
should be removed.
score:5
this is version problem. install the right dependent version:
npm uninstall node-sass
npm install node-sass@4.14.1
score:7
using npm,
npm uninstall node-sass
npm install node-sass
- change the
"react-scripts": "4.0.0"
into"react-scripts": "4.0.3"
in package.json and save npm install
npm start
or, using yarn -
yarn remove node-sass
yarn add --dev node-sass
- as above
yarn install
yarn start
score:13
score:19
the best solution for me was uninstalling node-sass.
npm uninstall node-sass
then install sass:
npm install sass
for those using yarn:
yarn remove node-sass
yarn add sass
score:50
node-sass
aka libsass is officially deprecated as of october 26 2020 and instead you should use sass
aka dart sass.
for npm
you could do:
npm uninstall node-sass
npm install sass --save-dev
for yarn
do:
yarn remove node-sass
yarn add sass
score:60
uninstall node-sass:
npm uninstall node-sass
use sass by:
npm install -g sass
npm install --save-dev sass
score:98
the only one reason why you get some error like that, is because your node.js version is not compatible with your node-sass version.
so, make sure to checkout the documentation at node-sass.
or this image below will be help you in deciding what node.js version can use the node-sass version.
for an example, if you're using node.js version 12 on your windows system ("maybe"), then you should have to install the node-sass version 4.12.
npm install node-sass@4.12
yeah, like that. so now you only need to install the node-sass version recommended by the node-sass team with node.js version installed on your computer.
Source: stackoverflow.com
Related Query
- Node Sass version 6.0.0 is incompatible with ^4.0.0 || ^5.0.0 in React.js
- Try to fix this error "Node Sass version 6.0.1 is incompatible with ^4.0.0 || ^5.0.0."
- Node Sass version 7.0.1 is incompatible with ^4.0.0
- Node Sass version 7.0.1 is incompatible with ^4.0.0 in React in Mac
- Node.js Sass version 7.0.0 is incompatible with ^4.0.0 || ^5.0.0 || ^6.0.0
- Node Sass Error due to Unsupported Environment OS X 64-bit with unsupported runtime
- error when importing local google fonts with sass new version
- Error: 'node-sass' version 5.0.0 is incompatible with ^4.0.0
- Syntax Error when test component with SASS file imported
- Pass an object with JS throw new Error in node
- Create React App with an older version of node
- flowtype bind cause error `Convariant property incompatible with contravariant use in assignment of property`
- Create-react-app failing with error: node incompatible with css-loader
- Flow error "props is incompatible with empty" when instantiating a Component without passing any props
- DevTools v4 is incompatible with this version of React
- react node passing file through axios with multer error 500
- Can't access sass variables compile error with react app
- Unexpected node type error SequenceExpression with jest
- Error with Webpack version 5.1.2 "MainTemplate.hooks.startup has been removed"
- Jest error with not transpiled node module
- I have created a simple node server with CORS enabled. But when I do node server.js, it's throwing error
- CRA: The engine "node" is incompatible with this module. Even though I have latest node
- Upgrading to create-react-app version 4.0 with react-app-rewired: server start error
- create react app & node sass chokidar with 7-1 sass architecture
- Node sass Error while doing npm install
- CORs error AFTER deploying React App and separate Node API to production Unbuntu server where React static files are servered with NGINX
- npm start error with create-react-app with react script version : "4.0.1"
- Property is "Display" incompatible with index signature typescript react error
- Problems with my routes in my production project with node js ERROR
- error redirect to react after local auth with passport using node js express
More Query from same tag
- React hooks state is not the latest when is used from a non-react callback
- reactjs function is calling after assigning variables
- /Reactjs fetching bringing a 405 status code in browser
- KeyCode returns undefined when function is bound to the class react
- The fetch("/createpost", {...} ) in CreatePost.js is returning an error
- How to get value from Multiple Checkbox to array in react?
- How do I load firebase data into react-redux asynchronously?
- Meteor.call in for each loop runs in infinite loop
- react-bootstrap NavBar padding
- How to simulate click on a react-leaflet Marker in my unit tests?
- Best ways of rendering a nested JSON in react?
- Applying logic to defaultProps
- Render single icon on hover using map - ReactJs
- Is it possible to pass a city obtained from the API to the following function?
- Formik form not updating fields upon edit
- The input textbox is not letting me insert a value
- Retrieve recompose local dispatch function from withReducer in withHandlers
- setInterval behaving sporadically in React app
- React-Router: pass props from one component to another using Navlink
- How to write 2 fetch method for contact API and Message API in reactjs?
- Firestore TypeError: collection().where() is not a function
- How to change some part of the code in the connect method(to be used mapStateToProps)and that action which are present here move to index.js(action)?
- React Ant Design table filtering not working
- Formik checkbox value not showing checked for a true value
- How to pass custom props to Single SPA child React apps?
- My query is failing in relay and I don't know why?
- Create React App: how to get final port dev-server running on
- Infinite loop in React button
- React JS Detect link from text this is my [web](https://www.google.com/)
- How to fix the error object could be possibly undefined using react and typescript?