Production deploy with docker image error

default discord avatar
henrikmaa
8 months ago
1

When starting container


node:internal/modules/cjs/loader:958





throw err;


^


Error: Cannot find module '/home/node/app/dist/server.js'


at Module._resolveFilename (node:internal/modules/cjs/loader:955:15)


at Module._load (node:internal/modules/cjs/loader:803:27)


at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)


at node:internal/main/run_main_module:18:47 {


code: 'MODULE_NOT_FOUND',


requireStack: []


}


Node.js v18.8.0



All env variables have been set. This error also occured when trying to execute without docker.



Note to others: This happens if you incorrectly mount volumes from host to container in docker



host_folder/dist : /dist


host_folder/build : /build

    Open the post
    Continue the discussion in Discord
    Like what we're doing?
    Star us on GitHub!

    Star

    Connect with the Payload Community on Discord

    Discord

    online

    Can't find what you're looking for?

    Get help straight from the Payload team with an Enterprise License.