Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Module Error (from ./node_modules/sass-loader/dist/cjs.js): Cannot find module 'sass'

I wrote to terminal:

npx create-react-app my-app --template redux-typescript

then i wrote

npm install -g sass

and i see in therminal

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

changed 17 packages in 2s
2 packages are looking for funding
  run `npm fund` for details
PS D:\WEB\portfolio\pizza> 

but in my package,json i don’t see it

  "dependencies": {
"@reduxjs/toolkit": "^1.9.2",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^27.5.2",
"@types/node": "^17.0.45",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^8.0.5",
"react-router-dom": "^6.8.1",
"react-scripts": "5.0.1",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"

},

and when i wrote
import "./sass/main.scss"
i see

Module Error (from ./node_modules/sass-loader/dist/cjs.js):
Cannot find module 'sass'

>Solution :

By using the -g flat, you are installing the package to the global scope. To add a package to package.json, just run npm install sass at the react app root directory.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading