Npm installation fails with 'Hash Sum mismatch' for gyp

Trying to install npm on my Lubuntu 20.04 system. Have already done sudo apt update and sudo apt upgrade prior to this, but when I run sudo apt install npm it fails with this Hash Sum mismatch error. any clues as to what’s up ?

After this operation, 67.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 gyp all 0.1+20180428git4d467626-3ubuntu1 [237 kB]
Err:1 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 gyp all 0.1+20180428git4d467626-3ubuntu1
  Hash Sum mismatch
  Hashes of expected file:
   - SHA256:ae340b63ac922531b18290768ee8a448747066dc6b52c5d0ec0446b59fab2bc0
   - SHA1:e90e368bc565aca62fee1164d5d46f312423ce25 [weak]
   - MD5Sum:2633912b473630f9d314ee384b657b0f [weak]
   - Filesize:237028 [weak]
  Hashes of received file:
   - SHA256:eccb7f4bc94cae4aa584f2a5b1f21ddda81fb791b76c2ad3584d4651cce69cec
   - SHA1:771151735c5b49c571969843067f5c7b37c8cd30 [weak]
   - MD5Sum:82ff3963915cd7fc7c8af8393cd6560b [weak]
   - Filesize:237028 [weak]
  Last modification reported: Wed, 22 Jan 2020 13:38:21 +0000
Fetched 237 kB in 0s (969 kB/s)
Unable to correct missing packages.
E: Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/universe/g/gyp/gyp_0.1+20180428git4d467626-3ubuntu1_all.deb  Hash Sum mismatch
   Hashes of expected file:
    - SHA256:ae340b63ac922531b18290768ee8a448747066dc6b52c5d0ec0446b59fab2bc0
    - SHA1:e90e368bc565aca62fee1164d5d46f312423ce25 [weak]
    - MD5Sum:2633912b473630f9d314ee384b657b0f [weak]
    - Filesize:237028 [weak]
   Hashes of received file:
    - SHA256:eccb7f4bc94cae4aa584f2a5b1f21ddda81fb791b76c2ad3584d4651cce69cec
    - SHA1:771151735c5b49c571969843067f5c7b37c8cd30 [weak]
    - MD5Sum:82ff3963915cd7fc7c8af8393cd6560b [weak]
    - Filesize:237028 [weak]
   Last modification reported: Wed, 22 Jan 2020 13:38:21 +0000
E: Aborting install.

Have also tried sudo apt install --fix-missing npm to no avail.

Looking at your paste, I can see you’re using a mirror provided by Esto Internet (see https://launchpad.net/ubuntu/+archivemirrors)

FYI: I pinged in.archive.ubuntu.com that was in your paste & thus had the result that it was Esto Internet

I occasionally get errors on my local mirror (they can occur if a sync is in progress), which are normally fixed by just waiting (5-15 minutes).

If you’re impatient, or it’s not fixed with time, you can clear our your cached copy of what’s available on your sources with the command

sudo rm -rf /var/lib/apt/lists/*

then your next run of sudo apt update your system will detect it can’t update your software lists (none are there), so it’ll download all new ones.

Note: there are cases where this isn’t enough, but it usually is :slight_smile:

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.