Jorah-M
Jorah-M

Reputation: 61

Node-sass not compiling

Trying to make css files from scss with node-sass. My package.json:

 {
  "name": "hello-webpack",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "scss": "node-sass -watch scss -o css"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "sass": "^1.26.10",
    "sass-loader": "^9.0.3",
    "webpack": "^4.44.1",
    "webpack-cli": "^3.3.11"
  },
  "dependencies": {
    "node-sass": "^4.14.1"
  }
}

But when i try npm run scss i see this error:

> node-sass -watch scss -o css

internal/validators.js:120
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at validateString (internal/validators.js:120:11)
    at Object.extname (path.js:1229:5)
    at getOptions (/Users/mac/Documents/Website/node_modules/node-sass/bin/node-sass:192:40)
    at Object.<anonymous> (/Users/mac/Documents/Website/node_modules/node-sass/bin/node-sass:376:15)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'ERR_INVALID_ARG_TYPE'
}
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 ERR! A complete log of this run can be found in:
npm ERR!     /Users/mac/.npm/_logs/2020-08-20T14_02_52_371Z-debug.log

What's wrong with path? It's correct, i got directories scss & css, and have some files in both.

Upvotes: 3

Views: 3920

Answers (1)

Mani Gandham
Mani Gandham

Reputation: 8272

You're using the watch option with the full name which requires 2 dashes:

node-sass scss --watch -o css

Otherwise use 1 dash with the shorthand w name:

node-sass scss -w -o css

https://www.npmjs.com/package/node-sass#command-line-interface

Upvotes: 5

Related Questions