I have this package.json:
{
"name": "natours",
"version": "1.0.0",
"description": "Landing page for natours",
"main": "index.js",
"scripts": {
"compile:sass": "node-sass sass/main.scss css/style.css -w"
},
"author": "Robert",
"license": "ISC",
"devDependencies": {
"node-sass": "^6.0.0"
}
}
When I try to run npm run compile:sass it gives me this error:
It worked for a while, but I updated the node version.
Also, if I run this command:
node-sass sass/main.scss css/style.css
From the command line, it works.
To fix this I uninstalled node-sass using this commands:
npm uninstall -S node-sass
npm uninstall -D node-sass
npm uninstall -g node-sass
And then install it again globally, using:
npm install -g node-sass
Before installing globally, I tried to install it with -D
flag to add it to dependencies or -S
flag to add it to devDependencies but it still didn't work, not sure why.
Maybe it's an incompatibility between npm and node-sass versions. I believe it can also be fixed using nvm.