From e0849878dd248de8988c2ef3fc941054625712ca Mon Sep 17 00:00:00 2001 From: Mike Sherov Date: Mon, 26 Jun 2017 10:24:17 -0400 Subject: [PATCH] lifecycle: avoid building environment for empty lifecycle scripts Credit: @mikesherov Reviewed-By: @iarna PR-URL: https://github.com/npm/npm/pull/17441 --- lib/utils/lifecycle.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/utils/lifecycle.js b/lib/utils/lifecycle.js index f8b34d7befada..02ba485aee145 100644 --- a/lib/utils/lifecycle.js +++ b/lib/utils/lifecycle.js @@ -60,6 +60,8 @@ function lifecycle (pkg, stage, wd, unsafe, failOk, cb) { delete pkg.scripts.prepublish } + if (!pkg.scripts[stage]) return cb() + validWd(wd || path.resolve(npm.dir, pkg.name), function (er, wd) { if (er) return cb(er)