node-sass is not recognized as an internal command

0

I'm trying to create a command to compile scss into css more easily.

I followed this tutorial

I installed nodejs, npm and node-sass

I joined my project and rode the command

  

npm init

My package.json looks like this:

{
"name": "piattino",
"version": "1.0.0",
"description": "Documenação do site piattivo.com.br",
"main": "index.js",
"scripts": {
  "test": "echo \"Error: no test specified\" && exit 1",
  "scss": "node-sass -watch scss -o css"
},
"author": "",
"license": "ISC"
}

after that I ran the command:

  

npm run scss

and then I get the following error:

> [email protected] scss C:\Users\bruno\projetos\piattino
> node-sass -watch scss -o css

'node-sass' n▒o ▒ reconhecido como um comando interno
ou externo, um programa oper▒vel ou um arquivo em lotes.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] scss: 'node-sass -watch scss -o css'
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] scss script.
npm ERR! This is probably not a problem with npm. There is likely additional 
logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean 
to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\bruno\AppData\Roaming\npm-cache\_logs18-11- 
01T15_04_15_598Z-debug.log

I use windows 7 64bit node v10.13.0 npm 6.4.1

    
asked by anonymous 01.11.2018 / 17:37

2 answers

1

You need to install node-sass globally:

npm install -g node-sass

Or add it to your package.json as a dependency:

"devDependencies": {
    "node-sass": "^4.9.0"
},

And then run:

npm install --save-dev node-sass

Your script is also incomplete, it should look like this:

"scss": "node-sass -watch -include-path scss -o css"
The -include-path defines the folder where the scss files are, and -o is the output folder of your compiled file.

Reference

    
01.11.2018 / 17:59
-1

node-sass to run on windows needs some C ++ components, install this face: link and see if you can.

    
01.11.2018 / 19:10