Skip to content

Commit

Permalink
Merge pull request #833 from salmanhasni/private-install-fix-for-meteor
Browse files Browse the repository at this point in the history
(build) Gracefully handle error if read/write package.json fails. Fixes #832
  • Loading branch information
dpa99c authored Oct 20, 2023
2 parents 4ae0365 + bd9e24a commit 0cb56f2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scripts/lib/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@ Utilities.setContext = function(context){
};

Utilities.parsePackageJson = function(){
return JSON.parse(fs.readFileSync(path.resolve('./package.json')));
try {
return JSON.parse(fs.readFileSync(path.resolve('./package.json')));
}
catch (error) {
if(error.code === "ENOENT") {
return {}
}
throw error;
}
};

Utilities.parseConfigXml = function(){
Expand Down

0 comments on commit 0cb56f2

Please sign in to comment.