jspm / jspm-cli

ES Module Package Manager
https://jspm.org
Apache License 2.0
3.78k stars 272 forks source link

unexpected end of file Zlib error #2149

Closed georgediaz88 closed 7 years ago

georgediaz88 commented 8 years ago

Hello,

First off, thanks for your excellent work with the jspm-cli.

I'm currently using the 0.17.0-beta.31 version to setup an Angular2 app in a Docker VM through VirtualBox for development. After creating a new VM instance running docker and getting setup, everything works great including an npm install but not a jspm install. I spent hours trying to figure out the failed install as I'm seeing:

err  Error on lookup for npm:ng2-cookies
Error: unexpected end of file
    at Zlib._handle.onerror (zlib.js:356:17)

and don't know how to fix it . This seems to be related to the jspm-cli in a Linux environment since I couldn't replicate in an OSX Mac environment. Have you seen this before and have a clue as to what may be happening or what setting I may need to turn on ?

I turned off strictSSL to false in my jspm config and that didn't help. Additional info is I'm using node v7 and npm version 3.10.8.

Here's the extended trace:

root@d9c83cd24821:/app# jspm i
     Creating registry cache...
     Downloading npm:angular2@2.0.0-beta.12
     Downloading npm:@angular/core@2.0.1
     Downloading npm:@angular/compiler@2.0.1
     Downloading npm:babel-runtime@5.8.34
     Downloading npm:@angular/platform-browser@2.0.1
     Downloading npm:@angular/platform-browser-dynamic@2.0.1
     Downloading github:nickL/ng-forward@master
     Downloading npm:babel-core@5.8.34
     Downloading npm:@angular/http@2.0.1
     Downloading npm:@angular/router@3.0.0
     Downloading npm:@angular/common@2.0.1
ok   Installed peer reflect-metadata to npm:reflect-metadata@0.1.3 (0.1.3)
     Downloading npm:@reactivex/rxjs@5.0.0-alpha.7
     Downloading npm:angular2@2.0.0-beta.1

warn Error on lookup for npm:store, retrying (1).
     Error: read ECONNRESET

err  Error on lookup for npm:ng2-cookies
Error: unexpected end of file
    at Zlib._handle.onerror (zlib.js:356:17)

err  Error looking up npm:ng2-cookies.

warn Installation changes not saved.

Thanks!

frederikschubert commented 8 years ago

I have also seen this many times in out CI system.

fdhenard commented 8 years ago

I'm also getting this error, and I posted an SO question about it here

guybedford commented 8 years ago

Does this happen every time or just sporadically? Does the Zlib error always happen along with the ECONNRESET error? It sounds like this is a low-level TCP issue while communicating with npm's servers. Did you try using a different version of Node perhaps?

If the error is persistent for anyone, in an environment that definitely works fine with npm, as much information about the environment setup would help.

frederikschubert commented 8 years ago

This happens every ~40th install on our CI system and the error is

err  Error: unexpected end of file
    at Zlib._handle.onerror (zlib.js:370:17)

There are no errors before this and there are no log outputs from jspm after the error.

Our setup is Linux 3.2.0-4-amd64, node 6.3.1 and npm 3.10.6.

georgediaz88 commented 8 years ago

@guybedford, this is happening for me every time on node >= 5.x . The thing is jspm used to work on >= 5.x and then what I think may have happened is it lost compatibility with later versions of Linux. It's ringing more true with the folks in this thread also reporting it happening in Linux. I use Docker in a VM and my current stack looks like:

Docker v1.12.3
Linux v4.4.27 (AUFS v4.4-20160912)
Parallels Tools v11.1.0-32202
VMware Tools (open-vm-tools) v10.0.0-3000743
VirtualBox Guest Additions v5.1.8
XenServer Tools (xe-guest-utilities) v6.6.80

node version: 6.9.1
npm version: 3.10.8

It also seems to be something related to strictly jspm . An npm install using package.json to install its dependencies always works . jspm 0.17.0-beta.31 just doesn't.

Recent trace:

root@c296b3d06a71:/app# jspm i
     Creating registry cache...

err  Error on lookup for npm:angular2
Error: unexpected end of file
    at Zlib._handle.onerror (zlib.js:370:17)

err  Error on lookup for npm:angular2
Error: unexpected end of file
    at Zlib._handle.onerror (zlib.js:370:17)

err  Error looking up npm:angular2.

warn Installation changes not saved.
fdhenard commented 8 years ago

@guybedford This happens for me everytime: Here are some setup details:

OS: Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-77-generic x86_64) (running on vagrant/VirtualBox) jspm: 0.16.47 node: 6.9.1 npm: 3.10.8

frederikschubert commented 8 years ago

Maybe it has something to do with this: http://stackoverflow.com/questions/33926969/how-can-i-avoid-zlib-unexpected-end-of-file-when-gunzipping-partial-files

If so I think the fix would be to pause the stream here.

guybedford commented 8 years ago

@frederikschubert that certainly looks like the right track. If you have the time to suggest a PR please do, otherwise I will look into this further when I can.

frederikschubert commented 8 years ago

I think I haven't got the time right now and am not familiar enough with the node stream API.

georgediaz88 commented 7 years ago

@guybedford, any update on when you might be able to take a look at this?

guybedford commented 7 years ago

@georgediaz88 unfortunately I don't have the resources to look into this until next year.

Smolations commented 7 years ago

I am just now seeing this issue as well. I have upgraded a packer-built vagrant box from Ubuntu 14.04 to 16.04. Both install node 4.4.4 and the default npm version via nvm. Had no issues on the 14.04 build, but now I'm getting these install errors on the 16.04 build. Each install seems to flag a different dependency, and it is a mix of ECONNRESET and package.json errors, e.g.:

ok   Up to date - angular-lory as github:houseofradon/angular-lory@0.1.6 (0.1.6)
ok   Up to date - nouislider as github:leongersen/noUiSlider@8.5.1 (8.5.1)

warn Error on lookup for npm:source-map, retrying (1).
     Error: read ECONNRESET

warn Error on lookup for npm:native-promise-only, retrying (1).
     Error: read ECONNRESET

warn Error on lookup for npm:eventemitter2
     Unable to parse package.json

err  Error looking up npm:eventemitter2.

warn Installation changes not saved.

This leads me to believe that it is perhaps an issue with the OS and its installed libraries. I can see that others are having issues on other OSes, but this has been my experience. Perhaps it is a networking issue or something? Also, I tried blowing away node_modules and upgrading JSPM to 0.16.47 to no avail, so past solutions used to update jspm-npm do not seem to solve the problem.

UPDATE: After more research, I thought that perhaps there were new problems related to synced folders with the vagrant VM (for some reason only present in Ubuntu 16.04?). However, this does not appear to be the case as I copied my entire shared folder structure and re-ran the install with the same results.

Smolations commented 7 years ago

Ugh. Just went back to Ubuntu 14.04 on my vagrant box and my jspm installs are now failing when they weren't before. And saw a new error as well:

warn Error on download for npm:d3, retrying (1).
     Error: read ECONNRESET
         at exports._errnoException (util.js:870:11)
         at TLSWrap.onread (net.js:552:26)

As mentioned above, normal npm installs do not fail, it is simply the jspm installs when fetching package information. This is highly frustrating. 😓

Smolations commented 7 years ago

OK, getting closer. The only thing different when going back to the old Ubuntu version in my vagrant box was the version of Virtualbox I was using. The original, working version was 5.0.16. In doing newer builds, I had upgraded to the newest version, which was 5.1.8. Downgrading to the older VBox version produced a vagrant box that had successful jspm installs. So it appears that my particular issues have to do with the newer version of Virtualbox. Something with the new VBox version and the way jspm fetches package info (via jspm-npm) is not quite right. Hope this helps anyone else having similar issues. I will continue to look for a solution with the newer version of Virtualbox and post here if I come up with anything.

Smolations commented 7 years ago

Alright, well what a coincidence, it appears that others were having similar issues as seen in this virtualbox issue thread. It looks like the VBox team hastened a release because I just noticed that 5.1.10 is available via homebrew. I gave it a go and jspm installs work in the built vagrant box! So, for my issue, and maybe some others from here, ditch VBox 5.1.8 and upgrade to 5.1.10 and hopefully everything returns to normal. This is a huge load off my shoulders.

@guybedford Sorry to eat up this whole thread with a Virtualbox issue. One less thing to worry about though, eh? 😋

fdhenard commented 7 years ago

@Smolations That was it for me. Thanks for digging into it so diligently!

georgediaz88 commented 7 years ago

@Smolations, great sleuthing!

Upgrading VBox to 5.1.10 was the answer. I'm glad their team figured this out and handed us a release of the fix!

@guybedford, +1 to what @Smolations said. Definitely one less thing for you to look at this upcoming year. Thanks for your work on jspm.