Fenghe's Blog

Parallelshell NPM – “options.cwd” property must be of type string. Received type function

I got an error when using [email protected] for automated interpretation of Scss during development. The package.json looks like the following.

{
"scripts": {
    "start": "npm run watch:all",
    "test": "echo \"Error: no test specified\" && exit 1",
    "lite": "lite-server",
    "scss": "node-sass -o css/ css/",
    "watch:scss": "onchange 'css/*.scss' -- npm run scss",
    "watch:all": "parallelshell 'npm run watch:scss' 'npm run lite'"
  }
}

And following is the error,

ypeError [ERR_INVALID_ARG_TYPE]: The "options.cwd" property must be of type string. Received type function
    at normalizeSpawnArguments (child_process.js:422:11)
    at spawn (child_process.js:532:38)
    at /Users/fenghexu/OneDrive - zju.edu.cn/Documents/Lifelong Learning/CS/full-stack/hkust/1-bootstrap/Bootstrap4/conFusion/node_modules/parallelshell/index.js:104:17
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/fenghexu/OneDrive - zju.edu.cn/Documents/Lifelong Learning/CS/full-stack/hkust/1-bootstrap/Bootstrap4/conFusion/node_modules/parallelshell/index.js:100:6)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
A screenshot of the error

It turns out that you have to replace the index.js with the js file here, which can be found in Ref. 1.

After that, all things should work.

References

  1. https://github.com/darkguy2008/parallelshell/issues/69

Leave a Reply

Your email address will not be published. Required fields are marked *