Reputation: 575
I am in folder C:\Users\borka\Desktop\Courses\HTML & CSS (Traversy)\Sandbox\13_sass
, using a bash terminal in VSCode and npm version 6.14.8.
I have successfully run npm init -y
and npm install node-sass
, then edited the package.json file to contain "scripts": { "sass": "node-sass -w scss/ -o dist/css/ --recursive" }
.
Then, I created a scss
directory with main.scss
inside, as well as a dist
directory. And finally, I run npm run sass
, but it fails and here's what I get:
> [email protected] sass C:\Users\borka\Desktop\Courses\HTML & CSS (Traversy)\Sandbox\13_sass
> node-sass -w scss/ -o dist/css/ --recursive
'CSS' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'C:\Users\borka\Desktop\Courses\node-sass\bin\node-sass'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] sass: `node-sass -w scss/ -o dist/css/ --recursive`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] sass script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\borka\AppData\Roaming\npm-cache\_logs\2021-01-31T16_01_42_707Z-debug.log
Notice how the Error: Cannot find module line displays a totally wrong path, one that doesn't even exist.
I've never worked with sass before and I have no idea what the problem is.
Upvotes: 0
Views: 414
Reputation: 575
Apparently the ampersand in the path was the cause. I removed it from folder name "HTML & CSS", and now everything's fine.
Upvotes: 0
Reputation: 74
I can't make a comment yet, but I think that the package you are looking for to compile your SASS into CSS is this one. I noticed your using node-sass
instead of regular sass
. You can install it by running:
npm install -g sass
To install it globally on your system, and then compile your SASS.
Try with the one I'm sharing, or, if your are using an IDE like VSCode, you can dowload an extension like Live Sass Compiler (that's the one I normally use).
Upvotes: 1