Maciej Szymonowicz
Maciej Szymonowicz

Reputation: 623

EINTEGRITY error when using Nexus proxy npm repo

So far we could build our node projects with default registry in .npmrc (registry = https://registry.npmjs.org/). We want to start publishing our internal libraries in local npm repository - we use Nexus 3. I created proxy repo directing to https://registry.npmjs.org/ (https://nexus.local/repository/npm-registry/). When we change registry in .npmrc for that proxy repo, building the same projects ends with errors like:

npm WARN tarball tarball data for wildcard@https://nexus.local/repository/npm-registry/wildcard/-/wildcard-2.0.0.tgz (sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==) seems to be corrupted. Trying again.
npm WARN tarball tarball data for minimist@https://nexus.local/repository/npm-registry/minimist/-/minimist-1.2.6.tgz (sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==) seems to be corrupted. Trying again.
npm ERR! code EINTEGRITY
npm ERR! sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw== integrity checksum failed when using sha512: wanted sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw== but got sha512-l5E0KJ9dH5bNZ9CxPNtF5KiMPlhF4eQZv7S2+Ko1HbeKTgRr9sMd8oe88VGS14dLESGihS27fqbDXq9d919xcw==. (33280 bytes)

Checking details about [email protected] package using both .npmrc configurations return the same result (especially the same sha512 value):

[jenkins@jenkins-agent-02 tmp.build]$ ~/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_18.6.0/bin/node ~/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_18.6.0/bin/npm view [email protected]

[email protected] | MIT | deps: none | versions: 10
Wildcard matching tools
https://github.com/DamonOehlman/wildcard#readme

keywords: string, wildcard

dist
.tarball: https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz
.shasum: a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec
.integrity: sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==
.unpackedSize: 21.7 kB

maintainers:
- damonoehlman <[email protected]>

dist-tags:
latest: 2.0.0

published over a year ago by damonoehlman <[email protected]>

I checked sha512 after downloading that package through our Nexus (https://nexus.local/repository/npm-registry/wildcard/-/wildcard-2.0.0.tgz) using command shasum -b -a 512 wildcard-2.0.0.tgz | awk '{ print $1 }' | xxd -r -p | base64 and it returns l5E0KJ9dH5bNZ9CxPNtF5KiMPlhF4eQZv7S2+Ko1HbeKTgRr9sMd8oe88VGS14dLESGihS27fqbDXq9d919xcw==. I have no idea why that sha512 was changed during downloading package through local Nexus.

I tried to invalidate cache in Nexus proxy repo configuration. Also checked some options in configuration view.

Upvotes: 0

Views: 521

Answers (1)

Maciej Szymonowicz
Maciej Szymonowicz

Reputation: 623

Problem was caused by Apache proxy configuration. Option AddEncoding must not include .tgz value.

Upvotes: 0

Related Questions