Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid distance too far back #22839

Closed
silenius opened this issue Sep 13, 2018 · 20 comments
Closed

invalid distance too far back #22839

silenius opened this issue Sep 13, 2018 · 20 comments
Labels
freebsd Issues and PRs related to the FreeBSD platform. zlib Issues and PRs related to the zlib subsystem.

Comments

@silenius
Copy link

Hello,

I'm getting a invalid distance too far back error message with npm/yarn (see yarnpkg/yarn#6357). It happens consistently and looks like a zlib error for corrupt data (?).

  • v10.9.0
  • FreeBSD dev.lan 10.3-RELEASE FreeBSD 10.3-RELEASE #0 r297264: Fri Mar 25 02:10:02 UTC 2016 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
  • Zlib
~/code/projects/amnesiabbpf/amnesiabbpf/frontend/ npm update webpack
npm ERR! code Z_DATA_ERROR
npm ERR! errno -3
npm ERR! invalid distance too far back

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jcigar/.npm/_logs/2018-09-13T11_39_20_299Z-debug.log
~/code/projects/amnesiabbpf/amnesiabbpf/frontend/ more /home/jcigar/.npm/_logs/2018-09-13T11_39_20_299Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'update',
1 verbose cli   'webpack' ]
2 info using npm@6.4.0
3 info using node@v10.9.0
4 verbose npm-session 0d2be4137d87cb91
5 verbose update computing outdated modules to update
6 silly mapToRegistry name webpack
7 silly mapToRegistry using default registry
8 silly mapToRegistry registry https://registry.npmjs.org/
9 silly mapToRegistry data { type: 'tag',
9 silly mapToRegistry   registry: true,
9 silly mapToRegistry   where: undefined,
9 silly mapToRegistry   raw: 'webpack',
9 silly mapToRegistry   name: 'webpack',
9 silly mapToRegistry   escapedName: 'webpack',
9 silly mapToRegistry   scope: undefined,
9 silly mapToRegistry   rawSpec: '',
9 silly mapToRegistry   saveSpec: null,
9 silly mapToRegistry   fetchSpec: 'latest',
9 silly mapToRegistry   gitRange: undefined,
9 silly mapToRegistry   gitCommittish: undefined,
9 silly mapToRegistry   hosted: undefined }
10 silly mapToRegistry uri https://registry.npmjs.org/webpack
11 verbose request uri https://registry.npmjs.org/webpack
12 verbose request no auth needed
13 info attempt registry request try #1 at 1:38:10 PM
14 verbose request id 81b3118c03482bfc
15 http request GET https://registry.npmjs.org/webpack
16 info retry will retry, error on last attempt: Error: invalid distance too far back
17 info attempt registry request try #2 at 1:38:20 PM
18 http request GET https://registry.npmjs.org/webpack
19 info retry will retry, error on last attempt: Error: invalid distance too far back
20 info attempt registry request try #3 at 1:39:20 PM
21 http request GET https://registry.npmjs.org/webpack
22 verbose stack Error: invalid distance too far back
22 verbose stack     at Zlib.zlibOnError [as onerror] (zlib.js:153:17)
23 verbose cwd /usr/home/jcigar/code/projects/amnesiabbpf/amnesiabbpf/frontend
24 verbose FreeBSD 10.3-RELEASE
25 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "update" "webpack"
26 verbose node v10.9.0
27 verbose npm  v6.4.0
28 error code Z_DATA_ERROR
29 error errno -3
30 error invalid distance too far back
31 verbose exit [ -3, true ]
@silenius
Copy link
Author

see RocketChat/Rocket.Chat#12024 too

@jasnell jasnell added question Issues that look for answers. wrong repo Issues that should be opened in another repository. and removed wrong repo Issues that should be opened in another repository. labels Sep 13, 2018
@silenius
Copy link
Author

silenius commented Sep 13, 2018

Downgrading from v10.9.0 to v8.11.4 fixed the issue.

this is with:

~/tmp/yarn/src/ pkg info node8
node8-8.11.4
Name           : node8
Version        : 8.11.4
Installed on   : Thu Sep 13 16:06:14 2018 CEST
Origin         : www/node8
Architecture   : FreeBSD:10:amd64
Prefix         : /usr/local
Categories     : www
Licenses       : MIT
Maintainer     : bhughes@FreeBSD.org
WWW            : https://nodejs.org/
Comment        : V8 JavaScript for client and server (8.x LTS)
Options        :
        BUNDLED_SSL    : on
        DOCS           : on
        NLS            : off
Shared Libs required:
        libcares.so.2
        libuv.so.1
Annotations    :
        FreeBSD_version: 1003000
        repo_type      : binary
        repository     : bebif
Flat size      : 27.0MiB
Description    :
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript
engine. Node.js uses an event-driven, non-blocking I/O model that
makes it lightweight and efficient. Node.js' package ecosystem,
npm, is the largest ecosystem of open source libraries in the world.

WWW: https://nodejs.org/

@jasnell
Copy link
Member

jasnell commented Sep 13, 2018

ping @addaleax ... any ideas here?

@Trott
Copy link
Member

Trott commented Sep 13, 2018

@nodejs/zlib

@addaleax addaleax added the zlib Issues and PRs related to the zlib subsystem. label Sep 13, 2018
@addaleax
Copy link
Member

@silenius Do you think you might be able to look at the file that decompression is failing on? Is this happening with every npm package you try to install?

@silenius
Copy link
Author

@addaleax : yes, it is happening with every package

@addaleax
Copy link
Member

@silenius Are you behind a proxy? Can you check whether this only happens on FreeBSD or not? Do you think you might be able to look into what exactly the data is that is being passed to zlib here?

@silenius
Copy link
Author

silenius commented Sep 13, 2018

@addaleax I'm not behind a proxy. I just tested on a freshly installed 11.2-RELEASE and it works as expected, so I think it only happens on FreeBSD <= 10.3.

@silenius
Copy link
Author

mmh apparently zlib has been upgraded in 10.4 (https://svnweb.freebsd.org/base?view=revision&revision=313796), so maybe it should work (unfortunately I don't have any 10.4 to test at the moment)

@addaleax
Copy link
Member

@silenius I think there’s a good chance that this would be a fix, yes. You can also try compiling Node.js from source, I think? We ship our own copy of zlib in our main tarball, so that could be unaffected by whatever bug you’re hitting?

@addaleax addaleax added freebsd Issues and PRs related to the FreeBSD platform. and removed question Issues that look for answers. labels Sep 14, 2018
@silenius
Copy link
Author

I'm closing this issue as it works on "officially supported" FreeBSD releases (> 10.3).. thanks for your help and sorry for the noise (:

@tmst
Copy link

tmst commented Dec 28, 2018

I'm getting this on OpenSuse Leap 42.3. I have no idea what I'm doing and was just playing around with a default project created with vue init webpack-simple my-vue-app and decided to delete node_modules to see if it could be recreated with vue install. Maybe it's the wrong install command?
Looking at the 7K+ line npm log file, you'd think I was compiling a kernel.

@smurfix
Copy link

smurfix commented Mar 19, 2019

The fix is to update your zlb. On Debian testing, as of now, 1.2.8 caused nodejs/npm to exhibit the fault while 1.2.11 did not.

@soederpop
Copy link

what do you mean by update zlib @smurfix ? doesn't it come as part of node itself? we're having this error and other random zlib errors regularly from node 11.9 on debian

@smurfix
Copy link

smurfix commented Mar 25, 2019

Debian dislikes vendorized libraries and uses the system's libraries wherever possible.

In any case, I had that exact error last week and fixed it by changing nothing – except updating the system's zlib.

@quantumpacket
Copy link

Updating zlib was what worked for me. Thanks.

@Frenkie64
Copy link

How do I update zlib on a Synology?

@PaulFPV
Copy link

PaulFPV commented Mar 26, 2020

How do I update zlib on a Synology?

Yes... how?

@bourgeoa
Copy link

bourgeoa commented Mar 28, 2020

@Frenkie64 @paulsview
https://stackoverflow.com/questions/60288671/npm-install-on-synology-gives-zlib-invalid-distance-error

If you don't want to install entware you can find zlib.so.1.2.11 inside the entware package for your machine. Example for x86_64 : https://pkg.entware.net/binaries/x86-64/Packages.html

I used chmod 755 in lieu of chmod +x

@davwheat
Copy link

I had this issue recently, but deleting .yarn/install-state.gz fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
freebsd Issues and PRs related to the FreeBSD platform. zlib Issues and PRs related to the zlib subsystem.
Projects
None yet
Development

No branches or pull requests