From 84d9aa508dcd40d1a396402f68e55c29cb72a8d8 Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Tue, 23 Aug 2016 17:56:00 +0300 Subject: [PATCH] fix(install): bin files are used once they were created link_bins was not returning a Promise. As a consequence the linking step was being completed too early and the next step was trying to use the bin files which were not yet created. --- lib/install/link_bins.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/install/link_bins.js b/lib/install/link_bins.js index 794154fd45..7c5301571b 100644 --- a/lib/install/link_bins.js +++ b/lib/install/link_bins.js @@ -17,9 +17,11 @@ module.exports = linkAllBins module.exports.linkPkgBins = linkPkgBins function linkAllBins (modules) { - getDirectories(modules) - .reduce((pkgDirs, dir) => pkgDirs.concat(isScopedPkgsDir(dir) ? getDirectories(dir) : dir), []) - .forEach(pkgDir => linkPkgBins(modules, pkgDir)) + return Promise.all( + getDirectories(modules) + .reduce((pkgDirs, dir) => pkgDirs.concat(isScopedPkgsDir(dir) ? getDirectories(dir) : dir), []) + .map(pkgDir => linkPkgBins(modules, pkgDir)) + ) } function getDirectories (srcPath) {