diff --git a/.changeset/rotten-swans-applaud.md b/.changeset/rotten-swans-applaud.md new file mode 100644 index 0000000000..6a75e9988d --- /dev/null +++ b/.changeset/rotten-swans-applaud.md @@ -0,0 +1,6 @@ +--- +"@pnpm/tarball-fetcher": patch +"pnpm": patch +--- + +Print a hint that suggests to run `pnpm store prune`, when a tarball integrity error happens. diff --git a/fetching/tarball-fetcher/src/remoteTarballFetcher.ts b/fetching/tarball-fetcher/src/remoteTarballFetcher.ts index 0e32ae0e07..3448e909ac 100644 --- a/fetching/tarball-fetcher/src/remoteTarballFetcher.ts +++ b/fetching/tarball-fetcher/src/remoteTarballFetcher.ts @@ -27,7 +27,14 @@ export class TarballIntegrityError extends PnpmError { }) { super('TARBALL_INTEGRITY', `Got unexpected checksum for "${opts.url}". Wanted "${opts.expected}". Got "${opts.found}".`, - { attempts: opts.attempts } + { + attempts: opts.attempts, + hint: `This error may happen when a package is republished to the registry with the same version. +In this case, the metadata in the local pnpm cache will contain the old integrity checksum. + +If you think that this is the case, then run "pnpm store prune" and rerun the command that failed. +"pnpm store prune" will remove your local metadata cache.`, + } ) this.found = opts.found this.expected = opts.expected