Skip to content

Commit 4a1aaf7

Browse files
committed
If npm -v fails, we should assume we're in yarn and do nothing
1 parent cbc29fa commit 4a1aaf7

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

lifecycleScripts/preinstall.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@ module.exports = function prepareForBuild() {
88
console.log("[nodegit] Running pre-install script");
99

1010
return exec("npm -v")
11-
.then(function(npmVersion) {
12-
if (npmVersion.split(".")[0] < 3) {
13-
console.log("[nodegit] npm@2 installed, pre-loading required packages");
14-
return exec("npm install --ignore-scripts");
15-
}
11+
.then(
12+
function(npmVersion) {
13+
if (npmVersion.split(".")[0] < 3) {
14+
console.log("[nodegit] npm@2 installed, pre-loading required packages");
15+
return exec("npm install --ignore-scripts");
16+
}
1617

17-
return Promise.resolve();
18-
})
18+
return Promise.resolve();
19+
},
20+
function() {
21+
// We're installing via yarn, so don't
22+
// care about compability with npm@2
23+
}
24+
)
1925
.then(function() {
2026
if (buildFlags.isGitRepo) {
2127
var submodules = require(local("submodules"));

0 commit comments

Comments
 (0)