node:16.15.1-buster-slim broken npm cache
It seems like the latest version of node:16.15.1-buster-slim is having a broken/outdated npm cache. Everytime I am trying to install my node modules (having a 3rd part dependency to npm) in a newly created container I am getting an tarball corrupted error.
Environment
- Node.js Version: 16.15.1
- Image Tag: node:16.15.1-buster-slim
Expected Behavior
Install completes successfully.
Current Behavior
npm WARN tarball tarball data for https://registry.npmjs.org/npm/-/npm-8.12.1.tgz (sha512-0yOlhfgu1UzP6UijnaFuIS2bES2H9D90EA5OVsf2iOZw7VBrjntXKEwKfCaFA6vMVWkCP8qnPwCxxPdnDVwlNw==) seems to be corrupted. Trying again.
npm WARN tarball tarball data for https://registry.npmjs.org/npm/-/npm-8.12.1.tgz (sha512-0yOlhfgu1UzP6UijnaFuIS2bES2H9D90EA5OVsf2iOZw7VBrjntXKEwKfCaFA6vMVWkCP8qnPwCxxPdnDVwlNw==) seems to be corrupted. Trying again.
npm ERR! code EINTEGRITY
npm ERR! sha512-0yOlhfgu1UzP6UijnaFuIS2bES2H9D90EA5OVsf2iOZw7VBrjntXKEwKfCaFA6vMVWkCP8qnPwCxxPdnDVwlNw== integrity checksum failed when using sha512: wanted sha512-0yOlhfgu1UzP6UijnaFuIS2bES2H9D90EA5OVsf2iOZw7VBrjntXKEwKfCaFA6vMVWkCP8qnPwCxxPdnDVwlNw== but got sha512-d3/o5QR8tYkCnfXdXadWE4Bv5XklvtTNVfqW0yZxFWTfwqAHDqb1eAvmp2bJv3WeVP0CYRZSf37wxb/PvgFFKQ==. (13270 bytes)
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-06-08T11_00_41_273Z-debug-0.log
Possible Solution
Recreate the image with an up-to-date cache.
When running npm update before npm install (as it was done above), the installation completes successfully.
Steps to Reproduce
- start container with the image, have a package.json including npm (
v8.12.1) dependency. - run
npm install - error occurs
With node:16.15.0-buster-slim the install is running fine.
Additional Information
Initially filed here: https://github.com/docker-library/official-images/issues/12601
There isn't anything in here that we do that would create anything in the NPM cache folder. It may be the same issue tracked upstream here https://github.com/nodejs/docker-node/issues/1734#issuecomment-1149712789
@mbenzenhoefer you did not specify the container spin-up command and whether you use root or node user. if the node user is used, then probably it won't have an access to /root directory
https://github.com/nodejs/docker-node/blob/5b9288e8646adb6b10ef262f3907cfcaf51ea0cd/Dockerfile-alpine.template#L6
npm ERR! /root/.npm/_logs/2022-06-08T11_00_41_273Z-debug-0.log
We are using the image within our gitlab runners, so I do not have direct access to this file at all. But it seems to be an issue of 16.15.1 because 16.15.0 works fine...