Can I Run Two Ongoing Npm Commands In 1 Terminal
Answer :
You could run one process in the background with &
(one ampersand, not two) but that would require you to manage it manually, which would be rather tedious. For details see What does ampersand mean at the end of a shell script line?.
For that use-case someone built concurrently
, which makes it simple to run processes in parallel and keep track of their output.
npm install --save-dev concurrently
And your start
script becomes:
"start": "concurrently 'npm run webpack' 'npm run server'"
If you want to make the output a little prettier you can give the processes names with -n
and colours with -c
, for example:
"start": "concurrently -n 'webpack,server' -c 'bgBlue.bold,bgGreen.bold' 'npm run webpack' 'npm run server'"
Comments
Post a Comment