0

I want to call multiple commands with the dev command. I found here that using concurrently is the best way to make this work since this would work on multiple OS.

How can I run multiple npm scripts in parallel?

I rand the folllwing aswell

npm install -g npm-windows-upgrade 
npm install -g concurrently
npm install concurrently

I can run them individually. But when I run the script with npm run dev I get the following error. Why can't npm find those commands?

Terminal

 [0] 'watch-client' is not recognized as an internal or external command,
        [0] operable program or batch file.
        [1] 'watch-server' is not recognized as an internal or external command,
        [1] operable program or batch file.
        [0] watch-client exited with code 1
        --> Sending SIGTERM to other processes..
        [1] watch-server exited with code 1
        npm ERR! code ELIFECYCLE
        npm ERR! errno 1
        npm ERR! diepio@1.0.0 dev: `concurrently --kill-others "watch-client" "watch-server"`
        npm ERR! Exit status 1
        npm ERR!
        npm ERR! Failed at the diepio@1.0.0 dev 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!     C:\Users\31614\AppData\Roaming\npm-cache\_logs\2019-12-24T11_09_40_394Z-debug.log

Package.json

 "scripts": {
        "dev": "concurrently --kill-others \"watch-client\" \"watch-server\" \"serve\"",
        "watch-client": "parcel ./src/client/index.html --open --out-dir ./builds/development/public",
        "watch-server": "parcel ./src/server/index.ts --out-dir ./builds/development/private --target node",
        "serve": "nodemon ./builds/development/private"
      }
Michael
  • 355
  • 1
  • 8
  • 17

2 Answers2

0

You may need to add npm and its submodules into your system PATH.

Have you downloaded the npm modules into your project directory?

You could also check that you have installed your npm submodules with the global argument.

0

The problem was that I was running the scripts in the wrong way I had to do it like this "dev": "concurrently --kill-others \"npm run watch-client\" \"npm run watch-server\" \"npm run serve\"",

Michael
  • 355
  • 1
  • 8
  • 17
  • when I do that I can't see console.log() any more no logs. How to show logs with concurrently commands? – Suisse Aug 25 '22 at 13:02