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

445
Visualizações
Docker build cannot find javascript modules (Docker/Nodejs/Express)

I'm building Express using Docker.

Previously, I uploaded it to the Ubuntu server using the Dockerfile. But suddenly there was an error. When building Docker Image, there was an error that could not read the file. When I build with Docker and run, It can't find the javascript module I made.

An error occurred even if dockerfile2 was used instead of dockerfile1.

I don't know what the problem is.

I updated Docker, too.

Docker version 20.10.8,


Error Msg.
(when use dockerfile1) Error msg : Cannot find module

Error Msg.
(when use dockerfile2)

> socket_example@1.0.0 start /usr/src/app
> node app.js

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

Error: Cannot find module './AgoraApi'
Require stack:
- /usr/src/app/src/audioChat/audioChannelHandler.js
- /usr/src/app/src/multiplay/rooms/GameRoom.js
- /usr/src/app/app.js

docker file1

FROM node:14
WORKDIR /
COPY  package.json ./
RUN  npm install
COPY  ./ ./
EXPOSE 4000
CMD [ "npm", "start" ]

docker file2

FROM node:14
WORKDIR /usr/src/app
COPY  package.json /usr/src/app
RUN  npm install
COPY  . /usr/src/app
EXPOSE 4000
CMD [ "npm", "start" ]

dockerignore file

.git
.gitignore

README.md
webpack.config.js
NAF-Gallery-Test.git
package-lock.json
backup
logs

node_modules
config/sql/*

!src
!util

Folder Structure

app.js
config.js
src
ㄴaudioChat
 ㄴagoraApi.js
util
ㄴvipRoomManager.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