0

I want to make react portfolio from freecodecamp. after all packages installed then change App.css to App.scss and then write some code, then show error like this:

"./src/App.scss (./node_modules/css-loader??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/sass-loader/lib/loader.js??ref--6-oneOf-5-3!./src/App.scss)
To import Sass files, you first need to install node-sass.
Run `npm install node-sass` or `yarn add node-sass` inside your workspace.
Require stack:
- C:\Tarikul\Projects\portfolio\node_modules\sass-loader\lib\loader.js
- C:\Tarikul\Projects\portfolio\node_modules\loader-runner\lib\loadLoader.js
- C:\Tarikul\Projects\portfolio\node_modules\loader-runner\lib\LoaderRunner.js
- C:\Tarikul\Projects\portfolio\node_modules\webpack\lib\NormalModule.js
- C:\Tarikul\Projects\portfolio\node_modules\webpack\lib\NormalModuleFactory.js
- C:\Tarikul\Projects\portfolio\node_modules\webpack\lib\Compiler.js
- C:\Tarikul\Projects\portfolio\node_modules\webpack\lib\webpack.js
- C:\Tarikul\Projects\portfolio\node_modules\react-scripts\scripts\start.js"

Then install "npm install node-sass":

Then show another error like this: "Error: Node Sass version 8.0.0 is incompatible with ^4.0.0."

I try to "npm install node-sass@4.0.0" and also try: "npm install node-sass@8.0.0" but problem is not fixed

Youssouf Oumar
  • 29,373
  • 11
  • 46
  • 65
Tarikul
  • 1
  • 1
  • Does this answer your question? [Error: Node Sass does not yet support your current environment](https://stackoverflow.com/questions/70322912/error-node-sass-does-not-yet-support-your-current-environment) – Youssouf Oumar Jan 30 '23 at 19:42

2 Answers2

1

Add this to your package.json:

"overrides": {
  "node-sass": "^8.0.0",
}

If you are using Node.js 18.x, you need node-sass@8.0.0. Older packages will probably have an older dependency. You can force the dependency, don't worry about compatibility, node-sass is deprecated and hasn't changed in years - except to support newer Node.js versions.

mmomtchev
  • 2,497
  • 1
  • 8
  • 23
0

Use sass instead

node-sass has been deprecated and the new version is sass

So, you can do the following

npm uninstall node-sass
npm install sass

No other changes needed

Abraham
  • 12,140
  • 4
  • 56
  • 92