How to stop any NPM script

When developing a NPM script you may notice the script doesn’t finish automatically. So, how to stop any NPM script? Let’s see.

How to stop any NPM script: success case

Just use the next line when you need to finish succesfully.

process.exit(0);

How to stop any NPM script: failure case

Just use the next line when you need to finish with an error.

process.exit(-1);

Leave a comment with your experience or questions!