From b915275a430fe76c3cbebd73c400fd2ac6df9207 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Sat, 8 Sep 2018 00:00:36 -0400 Subject: [PATCH] Make sure dir exists when stat'ing Otherwise an exception is thrown and things fail on an npm run init Auditors: @bridiver --- lib/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util.js b/lib/util.js index 6e2abfc9d5fe..5276c5dcec5f 100644 --- a/lib/util.js +++ b/lib/util.js @@ -151,7 +151,7 @@ const util = { for (var i in sourceFiles) { const sourceFile = sourceFiles[i] let destinationFile = output - if (fs.statSync(destinationFile).isDirectory()) { + if (fs.existsSync(destinationFile) && fs.statSync(destinationFile).isDirectory()) { destinationFile = path.join(destinationFile, path.basename(sourceFile)) }