Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

442
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!