0

Good day developers, I'm having an issue running multiple npm scripts using parallel shell. Here are the dependencies in my package.json file:

{
  "name": "confusion",
  "version": "1.0.0",
  "description": "This is a website for Ristorante Con Fusion",
  "main": "index.html",
  "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\""
    },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "lite-server": "^2.3.0",
    "node-sass": "^7.0.1",
    "onchange": "^7.1.0",
    "parallelshell": "^3.0.2"
  },
  "dependencies": {
    "bootstrap": "^4.0.0",
    "bootstrap-social": "^5.1.1",
    "font-awesome": "^4.7.0",
    "jquery": "^3.3.1",
    "popper.js": "^1.12.9"
  }
}

From my npm scripts, it can be observed that the npm start runs the watch:all script which in turn triggers the npm run watch:scss and npm run lite Here is my error after running the npm start command in cmd:

 [email protected] start
> npm run watch:all

npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

> [email protected] watch:all
> parallelshell "npm run watch:scss" "npm run lite"

node:internal/fs/utils:671
    throw new ERR_INVALID_ARG_TYPE(propName, ['string', 'Buffer', 'URL'], path);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "options.cwd" property must be of type string or an instance of Buffer or URL. Received function wrappedCwd
    at normalizeSpawnArguments (node:child_process:530:11)
    at spawn (node:child_process:693:13)
    at C:\Users\user\Desktop\FSWD\sandbox\Bootstrap4\conFusion\node_modules\parallelshell\index.js:104:17
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (C:\Users\user\Desktop\FSWD\sandbox\Bootstrap4\conFusion\node_modules\parallelshell\index.js:100:6)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  code: 'ERR_INVALID_ARG_TYPE'
}

I am using node version **v16.15.1

1 Answer 1

0

you can use npm-run-all for this instead of parallel shell install npm-run-all by using $ npm install npm-run-all --save-dev then change the srcipt as "watch:all": "npm-run-all --parallel watch:scss lite " Its Working for me :- enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks very much, it worked perfectly. Thanks to you my styles.scss automatically compiles and is served on the lite server on Ctrl + S. Its been giving me a hassle for close to a month now

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.