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

443
Vistas
docker build problem with npm install Error: Invalid response body while trying to fetch https://registry.npmjs.org Socket timeout

docker build problem with npm install and it's only inside docker I've tested. it's working on my os perfectly

Error

Step 6/8 : RUN npm cache clear --force &&  npm install --legacy-peer-deps
 ---> Running in 361c2a07ac22
npm WARN using --force Recommended protections disabled.
npm notice 
npm notice New minor version of npm available! 8.4.1 -> 8.5.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.5.0>
npm notice Run `npm install -g npm@8.5.0` to update!
npm notice 
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/styled-jsx: Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-02-17T07_12_06_500Z-debug-0.log
The command '/bin/sh -c npm cache clear --force &&  npm install --legacy-peer-deps' returned a non-zero code: 1

docker file

FROM node:alpine

WORKDIR /app

ENV PORT 3000

COPY ./package.json /app/
COPY ./.npmrc ~

RUN npm cache clear --force &&  npm install --legacy-peer-deps

COPY . /app/

CMD ["npm", "start"]

as u can see I have added .npmrc file because I have read it somewhere but it didn't work or add npm cache clear --force so what should I do?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

What version of Node your app is using? And what version of node you have installed on your OS?

You can check it using:

node -v

This image you used node:alpine is the newest version of the node, currently it's 17. So maybe you should use older one (the one you actualy have in your app). You can find correct image on Docker Hub

about 4 years ago · Juan Pablo Isaza 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