'get error Cannot find module '/app/app.js' when start NextJs on docker

I have a project on docker developing by nextjs and laravel. The project runs successfully on my laptop but when I try to run this project on another sustem with the same OS(I'm using Linux Mint 20 ) I've get this error:

 Node.js v18.1.0
 node:internal/modules/cjs/loader:942
   throw err;
   ^
 
 Error: Cannot find module '/app/app.js'
     at Module._resolveFilename (node:internal/modules/cjs/loader:939:15)
     at Module._load (node:internal/modules/cjs/loader:780:27)
     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
     at node:internal/main/run_main_module:17:47 {
   code: 'MODULE_NOT_FOUND',
   requireStack: []
 }

This is my docker file for NExtJs:

FROM node-alpine as frontend-stage

LABEL maintainer="LuuSean"

WORKDIR /var/www/html/frontend

COPY . .

EXPOSE 3000

CMD [ "yarn", "dev" ]

Why this happens when the docker file is same on both systems and containers should be independent from other conditions.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source