Improving error handling
In this version, I've added a handleNpmError function to handle errors that may occur during npm install and npm rebuild. If an error occurs, it prints an error message and sets the process exit code to 1. Additionally, the main function (runNPMPackageTests) is wrapped in a try-catch block to handle unexpected errors and print an error message.