From e3c95e14e169c94d139ff27110b06a407354f42d Mon Sep 17 00:00:00 2001 From: Tyler Wanek Date: Thu, 21 Feb 2019 10:30:22 -0700 Subject: [PATCH] If npm -v fails, we should assume we're in yarn and do nothing --- lifecycleScripts/preinstall.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lifecycleScripts/preinstall.js b/lifecycleScripts/preinstall.js index 6d481658b..870cf1558 100644 --- a/lifecycleScripts/preinstall.js +++ b/lifecycleScripts/preinstall.js @@ -8,14 +8,22 @@ module.exports = function prepareForBuild() { console.log("[nodegit] Running pre-install script"); return exec("npm -v") - .then(function(npmVersion) { - if (npmVersion.split(".")[0] < 3) { - console.log("[nodegit] npm@2 installed, pre-loading required packages"); - return exec("npm install --ignore-scripts"); - } + .then( + function(npmVersion) { + if (npmVersion.split(".")[0] < 3) { + console.log( + "[nodegit] npm@2 installed, pre-loading required packages" + ); + return exec("npm install --ignore-scripts"); + } - return Promise.resolve(); - }) + return Promise.resolve(); + }, + function() { + // We're installing via yarn, so don't + // care about compability with npm@2 + } + ) .then(function() { if (buildFlags.isGitRepo) { var submodules = require(local("submodules"));