Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

236
Vistas
npm WARN old lockfile The package-lock.json file was created with an old version of npm

I've a dockerfile as below, but during RUN npm ci step, there is a warning,

npm WARN old lockfile The package-lock.json file was created with an old version of npm

which I can not able to figure out..

I tried with npm install rather npm ci and added the --package-lock flag, but I am still getting this warning. It’s a kind of warning that I have to ignore it or what should I do to solve this?

Step 12/26 : RUN npm ci --production --package-lock &&     npm ci --production --package-lock --prefix ./ui-runner
 ---> Running in 3473c209b98c
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile

Here is my Dockerfile.

FROM node:14.17.1-alpine3.13 AS builder
WORKDIR /usr/src/app
COPY package.json package-lock.json* ./
COPY ui-runner/package*.json ./ui-runner/
COPY .npmrc .npmrc
COPY ui-runner/.npmrc ./ui-runner/.npmrc
RUN npm -g install npm@7.19.1
RUN npm ci --production --package-lock && \
    npm ci --production --package-lock --prefix ./ui-runner
RUN rm -f .npmrc && \
    rm -f ui-runner/.npmrc

FROM node:14.17.1-alpine3.13
WORKDIR /usr/src/app
RUN apk update && apk add --no-cache curl bash
RUN addgroup -g 1001 test && \
    adduser -S -u 1001 -G test test
RUN chown -R test /usr/src/app && \
    chmod 755 /usr/src/app
COPY --from=builder /usr/src/app /usr/src/app
COPY . .
RUN npm run build:docker
USER test
EXPOSE 3000 9183
CMD [ "npm", "run", "start:ui-runner" ]
over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

There are several ways to deal with this:

  1. Ignore it. It's just a warning and does not affect the installation of modules.

  2. Run npm install --package-lock-only (with the newer version of npm) to regenerate a package-lock.json. Commit the updated version of package-lock.json to the repo/Docker image or whatever.

  3. Downgrade npm to an older version in production. Consider running npm version 6 as that is what ships with the current (as of this writing) Long Term Support (LTS) version of Node.js. In the case being asked about in this question, I imagine you can just leave out the RUN npm -g install npm@7.19.1 from the Dockerfile and instead use the version of npm that is installed with the Docker image (which in this case will almost certainly be npm@6 since that is what ships with Node.js 14.x).

  4. If you already have a version of npm installed but want to run one command with an older version of npm but otherwise keep the newer version, you can use npx (which ships with npm) to do that. For example, npx npm@6 ci would run npm ci with npm version 6 even if you have version 7 installed.

over 4 years ago · Santiago Trujillo Denunciar

0

I had a similar problem but upgrading npm npm i -g npm on my machine before building the image solved it for me. You may still get the warn message but the image build process won't be halted.

over 4 years ago · Santiago Trujillo Denunciar

0

I am having the same problem as well after upgrading my npm version. It seems like a bug from npm 7.19.1, and I'd suggest to downgrade to an older version.

You can check below for all the npm versions

https://www.npmjs.com/package/npm?activeTab=versions

Install the desired version with this command in the console, and substitute "V" with your desired version:

npm install -g npm@"V"
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda