Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

444
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda