Skip to content

Commit ab3f379

Browse files
authored
Merge pull request #1644 from implausible/fix/yarn-with-no-npm
Don't fail yarn installs when we can't find npm
2 parents 5128765 + e3c95e1 commit ab3f379

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

lifecycleScripts/preinstall.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,22 @@ 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(
15+
"[nodegit] npm@2 installed, pre-loading required packages"
16+
);
17+
return exec("npm install --ignore-scripts");
18+
}
1619

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

0 commit comments

Comments
 (0)