I'm facing a problem related to npm/yarn. We have an npm registry hosted in one of our VMs using Verdaccio to publish our private packages. When we install packages other than our own for the first time, they all are routed to registry.npmjs.org through http://localhost:4873 and cached on our VM for further quick access.
The problem is, if I install @amcharts/amcharts4-geodata package (which is around 71 MB of a tar file), I'm getting an error unexpected end of file
. If I use verbose flag in npm install, I find that this is because of NodeJS not able to extract the zip file.
The error stack is:
Error: http://localhost:4873/@amcharts%2famcharts4-geodata/-/amcharts4-geodata-4.1.16.tgz: unexpected end of file
at Zlib.zlibOnError [as onerror] (zlib.js:183:17)
Observed and things I have tried:
- It happens with both yarn and npm.
- I disabled cache on Verdaccio. However disabling cache will still store the meta data of all third party packages.
- Changing nodejs version doesn't have any impact.
- If I create a simple test folder and install the same package there without giving a custom registry, it works.
- I added a reverse proxy of nginx behind Verdaccio but it didn't fix the problem.
replace
yarn install
withyarn install || yarn install || yarn install
if you require even more stability, try
source: https://github.com/yarnpkg/yarn/issues/7521#issuecomment-564122782