From 30992a8c51b2b257a00464fc27935c023773e06d Mon Sep 17 00:00:00 2001 From: Sandro Date: Tue, 19 Sep 2023 01:36:06 +0200 Subject: [PATCH] buildNpmPackage: give a hint when npm prune fails Co-authored-by: Lily Foster --- .../node/build-npm-package/hooks/npm-install-hook.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh b/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh index 64ddcbd567fc..903dbc7eef0c 100644 --- a/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh +++ b/pkgs/build-support/node/build-npm-package/hooks/npm-install-hook.sh @@ -34,7 +34,16 @@ npmInstallHook() { if [ ! -d "$nodeModulesPath" ]; then if [ -z "${dontNpmPrune-}" ]; then - npm prune --omit=dev --no-save ${npmWorkspace+--workspace=$npmWorkspace} $npmPruneFlags "${npmPruneFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}" + if ! npm prune --omit=dev --no-save ${npmWorkspace+--workspace=$npmWorkspace} $npmPruneFlags "${npmPruneFlagsArray[@]}" $npmFlags "${npmFlagsArray[@]}"; then + echo + echo + echo "ERROR: npm prune step failed" + echo + echo 'If npm tried to download additional dependencies above, try setting `dontNpmPrune = true`.' + echo + + exit 1 + fi fi find node_modules -maxdepth 1 -type d -empty -delete