节点sass未编译

节点sass未编译,sass,node-sass,Sass,Node Sass,尝试使用节点sass从scss生成css文件。 My package.json: { "name": "hello-webpack", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "

尝试使用节点sass从scss生成css文件。 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"
  }
}
但当我尝试npm运行SCS时,我看到了以下错误:

> 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! hello-webpack@1.0.0 scss: `node-sass -watch scss -o css`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the hello-webpack@1.0.0 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
>节点sass-监视scss-o css
internal/validators.js:120
抛出新错误\u无效的\u参数\u类型(名称,'string',值);
^
TypeError[ERR_INVALID_ARG_TYPE]:“path”参数必须是string类型。接收未定义
在validateString(internal/validators.js:120:11)
在Object.extname(path.js:1229:5)
在getOptions(/Users/mac/Documents/Website/node_modules/node sass/bin/node sass:192:40)
反对。(/Users/mac/Documents/Website/node_modules/node sass/bin/node sass:376:15)
at模块编译(内部/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js(internal/modules/cjs/loader.js:1157:10)
在Module.load(内部/modules/cjs/loader.js:985:32)
at Function.Module._load(内部/modules/cjs/loader.js:878:14)
在Function.executeUserEntryPoint[作为runMain](internal/modules/run_main.js:71:12)
在internal/main/run_main_module.js:17:47{
代码:“错误\无效\参数\类型”
}
npm错误!代码失效循环
npm错误!错误1
npm错误!你好-webpack@1.0.0scss:`node sass-watch scss-o css`
npm错误!退出状态1
npm错误!
npm错误!打招呼时失败了-webpack@1.0.0scss脚本。
npm错误!这可能不是npm的问题。上面可能还有其他日志输出。
npm错误!此运行的完整日志可在以下位置找到:
npm错误/Users/mac/.npm/_logs/2020-08-20T14_02_52_371Z-debug.log

路径有什么问题?这是正确的,我有目录SCS和css,两个目录中都有一些文件。

您使用的是带有全名的
watch
选项,需要两个破折号:

node-sass scss --watch -o css
否则,请使用1个短划线和速记
w
名称:

node-sass scss -w -o css