DEV Community

Jen C.
Jen C.

Posted on

Use concurrently for monitoring TypeScript compiling and restarting the node application using nodemon

Issues and Solutions

error [0] & was unexpected at this time. [0] npx tsc --watch exited with code 1 [1] & was unexpected at this time. [1] nodemon -q dist/index.js exited with code 1 After installed concurrently and nodemon and added "dev": "concurrently \"npx tsc --watch\" \"nodemon -q dist/index.js\"" in package.json

Running concurrently error

Root cause

(One of the error, not the root one) get error bash: nodemon: command not found (on Windows) when running command nodemon -q dist/index.js.

Solution change nodemon -q dist/index.js to npx nodemon -q dist/index.js

The root cause might be the setting of Visual Studio Code
in Windows environment 😭

Solution (Not the ideal one)

  • Run command npx tsc --watch and npx nodemon -q dist/index.js in two different terminals and both work fine

Output of npx tsc --watch

Output of running nodemon

Reference

  1. https://stackoverflow.com/questions/35530930/nodemon-not-working-bash-nodemon-command-not-found

Top comments (0)