From 6f3892cc7f05931238f3afbc4a099bcdd45d993d Mon Sep 17 00:00:00 2001 From: Zoltan Kochan Date: Sat, 13 Apr 2019 01:43:37 +0300 Subject: [PATCH] fix(build-modules): don't fail when cannot link bin of a subdep --- packages/build-modules/src/index.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/build-modules/src/index.ts b/packages/build-modules/src/index.ts index 1af6432cd8..d1d4c99641 100644 --- a/packages/build-modules/src/index.ts +++ b/packages/build-modules/src/index.ts @@ -185,9 +185,19 @@ export async function linkBinsOfDependencies ( return nonOptionalChildren }, {}) + const binPath = path.join(depNode.peripheralLocation, 'node_modules', '.bin') + const pkgs = await Promise.all( R.keys(childrenToLink) - .filter((alias) => depGraph[childrenToLink[alias]].hasBin && depGraph[childrenToLink[alias]].installable !== false) + .filter((alias) => { + const dep = depGraph[childrenToLink[alias]] + if (!dep) { + // TODO: Try to reproduce this issue with a test in supi + opts.warn(`Failed to link bins of "${alias}" to "${binPath}". This is probably not an issue.`) + return false + } + return dep.hasBin && dep.installable !== false + }) .map(async (alias) => { const dep = depGraph[childrenToLink[alias]] return { @@ -197,7 +207,6 @@ export async function linkBinsOfDependencies ( }), ) - const binPath = path.join(depNode.peripheralLocation, 'node_modules', '.bin') await linkBinsOfPackages(pkgs, binPath, { warn: opts.warn }) // link also the bundled dependencies` bins