Npm EINTEGRITY errors

Hi,

I’m using Nexus Repository Manager 2 in order to host npm packages in an offline environment (not connected to the internet).

Using npm install I download from the internet the modules I need (such as Angular) and copy the node modules to my offline environment. Then I used the following protocol for each module/folder:

  1. compress the folder into tar file.
  2. compress the tar file into gzip file.
  3. change the file extension from .tar.gz into .tgz
  4. rename to file to: {module name}-{version}.tgz - the version is taken from package.json
  5. create a folder with the module name, then create a sub folder named “-”.
  6. put the .tgz file under the “-” folder.
  7. copy the module folder to the Nexus storage.
  8. Rebuild the metadata.

I don’t know if it’s the right protocol to use in order to copy node modules into the repo, but it worked so far…

Lately I’m getting the following error when trying to do npm install for some of the angular packages I copied:

npm ERR! code EINTEGRITY
npm ERR! sha512-w0XZubFWn0Adlsapj9EAWX0FqWdO4tz8kc3RiYdWLh4k/V8PTb6i0SMgXt0vRM3zyKnT8tKO7mUlieRQHIjMNg==
integrity checksum failed when using sha512:
wanted sha512-w0XZubFWn0Adlsapj9EAWX0FqWdO4tz8kc3RiYdWLh4k/V8PTb6i0SMgXt0vRM3zyKnT8tKO7mUlieRQHIjMNg==
but got sha512-ZaDQrX7E1dcPtQZVG9rFth+yjJctgMKIbLl85Jq5fprWK2R3hiOEXyHTXJ259dZ8P5WNELsuswv6CTPfNKj/8A==

(the checksums are just an example)

Any idea on how to fix the problem? Any other protocol I can use in order to copy republish modules from the internet on my offline repo?

b.t.w. Using npm publish on those packages resulted the same problem.

Are you retrieving these through a group repository? If so, it is possible another repository in the group has metadata for these packages which has a different checksum. So you’d be getting the wrong checksums. If this is the case putting the hosted repository at the top of the goup’s list of repos should solve this.

Thank you! That was the problem.