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

157
Visualizações
Cannot find module '/home/backend/dist/src/server.js' with Docker

Very new to Docker but When trying to run the container after building I get the following error, has anyone ran into this before?

'internal/modules/cjs/loader.js:905
throw err;'
^

'Error: Cannot find module '/home/backend/dist/src/server.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []'

I have built without docker and seems to work fine I run the following commands against the dockerfile (below):

docker build -t [name] .

docker run [name]

 FROM node:14.17.1 as base
 WORKDIR /home/backend
 //Add package file
 COPY package.json ./
 COPY yarn.lock ./
 //Install deps
 RUN yarn install

 //Copy source
 COPY src ./src
 COPY tsconfig.json ./tsconfig.json

 //Build dist
 RUN yarn build

 //Start production image build
 FROM gcr.io/distroless/nodejs:14

 //Copy node modules and build directory
 COPY --from=base /home/backend/dist ./home/backend/dist

 //Expose port 5000
 EXPOSE 5000
 CMD [ "/home/backend/dist/src/server.js" ]
about 4 years ago · Juan Pablo Isaza
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