Recently my co-worker recommends a great VS extension NPM task runner. Instead of running NPM task via a separate terminal, it will discover NPM task via package.json and run them inside Visual Studio by a double-click.
Install via Tools > Extensions and Updates > Online > Search NPM task runner
Task Runner Explorer locate in View > Other Windows > Task Runner Explorer
Run task by double-click tasks in sidebar, close it by x
button
If your task fails, it probably references to wrong NPM or Node.js, to fix it change the order in Tools > Options > Projects and Solutions > External Web Tools
. I lift-up ${PATH}
to the second one.