Node-Sass is not recognized as an internal command

Asked

Viewed 2,948 times

1

I’m trying to create a command for compile scss in css more easily.

I followed this tutorial

I installed nodejs, npm and Node-Sass

I got into my project and ran the remote

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 circled the command:

npm run scss

and then I get the following mistake:

> [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\_logs\2018-11- 
01T15_04_15_598Z-debug.log

use windows 7 64bits Node V10.13.0 npm 6.4.1

  • I believe you probably forgot to install Node-Sass. Use the command npm i node-sass.

2 answers

2


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 execute:

npm install --save-dev node-sass

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

"scss": "node-sass -watch -include-path scss -o css"

The -include-path sets the folder where the files scss are, and the -o is the output folder of your compiled file.

Reference

  • path.js:39 throw new ERR_INVALID_ARG_TYPE('path', 'string', path); Typeerror [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type Undefined at assertPath (path.js:39:11)

  • I tried installing Node-Sass globally and after trying npm run scss gave this error above. Otherwise, after running 'npm install --save-dev Node-Sass' a huge error appeared that I cannot paste here but the beginning of it is this: Downloading Binary from https://github.com/sass/node-sass/releases/download/v4.5.0/win32-x64_binding.node Download cannot download "https://github.com/sass/node-sass/releases/download/v4.5.0/win32-x64-64_binding.node": HTTP error 404 Not Found

  • Try again now, I edited the answer with a newer version of the package as dependency.

  • thanks so much for the help but gave the same error. in case that first comment I made.

  • Edited again, your script on package.json is incomplete, I realized only agr qd tried to execute him.

  • I made the edits in the script and after running 'npm run scss' the process gets hung up, have any idea why?

  • He’ll be watching changes in the files scss, that is, every time you make some modification and save the file, it will be compiled automatically.

  • SHOW! Thank you so much now gave right!

Show 3 more comments

-1

  • thanks Felipe, I installed here but it did not have an effect

Browser other questions tagged

You are not signed in. Login or sign up in order to post.