Karl B.
Karl B.

Reputation: 263

npm run build with .bat prevent window from closing

I have a simple .bat file so i can easily execute npm commands without typing them everytime, but when i try it with 'npm run build' the window closes after the script finishes.
I cant see the results from npm run build :/.
I tried PAUSE or cmd /k but the cmd keeps closing...

create-build.bat:

cd myfolder
npm run build

Thanks in advance!

Upvotes: 9

Views: 4640

Answers (2)

Shaedo
Shaedo

Reputation: 453

prefix 'call' to your npm commnands: eg

call npm i -D eslint eslint-config-airbnb-base eslint-pl

This is a work around, and it's good to understand the limitations. A decent discussion can be found here: https://github.com/npm/npm/issues/2938

Upvotes: 13

RGuggisberg
RGuggisberg

Reputation: 4750

npm evidently does an EXIT. here is the command line I use to do that.

CMD /C "C:\Program Files\nodejs\npm" i --loglevel error

Upvotes: 1

Related Questions