npm install fails with "npm ERR! tar.unpack untar error"

Problem npm failed randomly while installing packages. It didn’t matter which packages or if running on Debian itself or inside virtual machines using Ubuntu (vagrant). Upgrading npm to the latest version (sudo npm install -g npm@latest ) and clearing npm’s cache (npm cache clean ) didn’t help either. After examining the downloaded temporary packages in /tmp I realized that they were corrupt. The corrupt packages changed randomly on every download attempt....

April 25, 2016 · 2 min