Search code examples
ubuntuvagrantubuntu-18.04

Why is "Hash Sum mismatch" when installing nodejs on vagrant box ubuntu/bionic64


I'm newbie of using Vagrant. Recently I have an project required Nodejs version 12.x, I decided start with vagrant project, but unfortunately getting trouble while installing. I using the same installation command for normal Ubuntu VM created by ISO file it working. Below are the bash command for installation and error message I get.

bash command

curl -sL https://deb.nodesource.com/setup_12.x  | sudo -E bash 
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install nodejs -y

Error

E: Failed to fetch https://deb.nodesource.com/node_12.x/pool/main/n/nodejs/nodejs_12.18.3-1nodesource1_amd64.deb  Hash Sum mismatch
   Hashes of expected file:
    - SHA256:546d5fd658be511f0568e2744b73eca3f04eb1b155491ff7bc0ffb373aa69bce
    - SHA1:ca9a7a04d0a8e01b8ec27f583185df234f89819a [weak]
    - MD5Sum:266488f3f4f8b9c82e92a57b2dd01048 [weak]
    - Filesize:18166022 [weak]
   Hashes of received file:
    - SHA256:33f571ecd7e761bbbd9445f47778a0f0a351a415e42ea12683865131c0ed922c
    - SHA1:b9363f314bbc2fc820542b1a28e27b395c60d4af [weak]
    - MD5Sum:7464ea66e911ef8817c5abf653468837 [weak]
    - Filesize:18166022 [weak]
   Last modification reported: Wed, 22 Jul 2020 18:28:18 +0000
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

I tried to follow this solution here to troubleshooting, but not working.

I'ii appreciate if anyone can help with this issue.


Solution

  • Another newbie here. I had the same issue with nodejs 14.x and Oragle VM VirtualBox 6.1.12.

    I tried to solve the issues (mongodb had the same hash issue) with removing removing /var/lib/apt/lists/*, updating with apt-get update --fix-missing, cleaning apt-get, installing different nodejs and mongodb versions, ...

    But which finally fixed my problems was downgrading VirtualBox from 6.1.12 (latest) to 6.0.24. Thanks for user VivekDev in another stackoverflow thread.

    After downgrading you may have issues with running virtual machines on VirtualBox. This can be solved with a cmd command (as an administrator) bcdedit /set hypervisorlaunchtype off. Restart PC and try again vagrant up.