Can't compile SCSS

Issue

So I’m learning SCSS and I want to compile my SCSS into CSS using npm, so I type

npm run compile: sass

which in my package.json means

"scripts": { "compile:sass": "node-sass sass/main.scss css/style.css" },

but this error message appears when I write the command

Error: Cannot find module 'C:\Users\(user)\OneDrive\Desktop\Code\node-sass\bin\node-sass' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

Note: file names are correct in my Package.json file

Does anyone know what is going on?

If you need more information reply and I can provide you with the files.

Solution

Its saying that you dont have the node-sass module installed have you tried npm install install node-sass in the project directory as per the documentation https://www.npmjs.com/package/node-sass .

Answered By – ian worsley

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published