1

I'm using the concurrently npm package (5.1.0) in my node project to run two npm scripts in parallel. But when I run npm start in cmd prompt to start my scripts, concurrently tries running the commands in, what I believe to be, my home dir which is the system32 folder on my machine.

I have the following in my package.json:

{
  "scripts": {
    "build:watch": "tsc -p src/ -w",
    "serve": "lite-server -c=bs-config.json",
    "start": "concurrently \"npm run build:watch\" \"npm run serve\""
  }
}

And this is the output I get:

> concurrently "npm run build:watch" "npm run serve"

[0] npm ERR! path C:\Windows\System32\package.json
[0] npm ERR! code ENOENT
[0] npm ERR! errno -4058
[0] npm ERR! syscall open
[0] npm ERR! enoent ENOENT: no such file or directory, open 'C:\Windows\System32\package.json'
[0] npm ERR! enoent This is related to npm not being able to find a file.
[0] npm ERR! enoent
[0]
[0] npm ERR! A complete log of this run can be found in:
[0] npm ERR!     C:\Users\myuser\AppData\Roaming\npm-cache\_logs\2020-04-08T21_07_59_146Z-debug.log
[1] npm ERR! path C:\Windows\System32\package.json
[1] npm ERR! code ENOENT
[1] npm ERR! errno -4058
[1] npm ERR! syscall open
[1] npm ERR! enoent ENOENT: no such file or directory, open 'C:\Windows\System32\package.json'
[1] npm ERR! enoent This is related to npm not being able to find a file.
[1] npm ERR! enoent
[0] npm run build:watch exited with code 4294963238
[1]
[1] npm ERR! A complete log of this run can be found in:
[1] npm ERR!     C:\Users\myuser\AppData\Roaming\npm-cache\_logs\2020-04-08T21_07_59_182Z-debug.log
[1] npm run serve exited with code 4294963238

I tried different versions of concurrently and tried to find a way to specify the working dir dynamically but have failed. Any help would be greatly appreciated.

Sal
  • 5,129
  • 5
  • 27
  • 53

1 Answers1

0

I fixed my problem by switching to npm-run-all.

After installing I simply changed my command to the following:

"start": "run-p build:watch serve"
Sal
  • 5,129
  • 5
  • 27
  • 53