There is a need to put Sass into the project on React and the problem here is: when the project starts, it gives an error:

Module build failed: Error: `sass-loader` requires `node-sass` >=4. Please install a compatible version. 

In this case, I have everything installed:

 "node-sass": "^4.8.3", "sass-loader": "^7.0.1", 

In the config registered the following:

 {test: /\.scss$/,include: paths.appSrc,loaders: ['style-loader', 'css-loader', 'sass-loader']} 

What could be the error, do not understand at all. I really hope for you!

  • but you can see the full webpack.config, as well as which version of webpack - xFloooo
  • although swears at the version of node-sass - xFloooo

2 answers 2

This is a problem in npm or in the cached version of node-sass. In order for sure to solve the problem you need to register npm install npm -g , then npm rebuild node-sass or (if it does not help):

  1. Remove node-sass from node_modules.
  2. Remove packages-lock.json.
  3. Remove node-sass from global npm cache (For Windows, this is% userprofile% \ AppData \ Roaming \ npm-cache)
  4. Update npm version to the latest.
  5. Reload the node-sass package.

    can see which packages need to be updated

    1. npm outdated checks which packages have updates, then it is advisable to manually update them (updating everything may lose compatibility with the project)

    2. in your case, the npm update --save node-sass team will install the latest stable version for you and rewrite it in package.json