Skip to content

Commit 12d4e48

Browse files
authored
pnpm.configHook: improve error message when install fails due to hash (#397491)
2 parents a660d95 + 3013867 commit 12d4e48

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

pkgs/development/tools/pnpm/fetch-deps/pnpm-config-hook.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,23 @@ pnpmConfigHook() {
4444

4545
runHook prePnpmInstall
4646

47-
pnpm install \
47+
if ! pnpm install \
4848
--offline \
4949
--ignore-scripts \
5050
"${pnpmInstallFlags[@]}" \
5151
--frozen-lockfile
52+
then
53+
echo
54+
echo "ERROR: pnpm failed to install dependencies"
55+
echo
56+
echo "If you see ERR_PNPM_NO_OFFLINE_TARBALL above this, follow these to fix the issue:"
57+
echo '1. Set pnpmDeps.hash to "" (empty string)'
58+
echo "2. Build the derivation and wait for it to fail with a hash mismatch"
59+
echo "3. Copy the 'got: sha256-' value back into the pnpmDeps.hash field"
60+
echo
61+
62+
exit 1
63+
fi
5264

5365

5466
echo "Patching scripts"

0 commit comments

Comments
 (0)