Search code examples
javascriptnode.jsnestjsnest

nest.js error when deploying start:prod to Digital Ocean App Platform


I have been trying to deploy my app to DO and I keep getting the error

Error: Cannot find module '/workspace/dist/main'
 at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
 at Function.Module._load (node:internal/modules/cjs/loader:841:27)
 at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
 at node:internal/main/run_main_module:22:47 {
 code: 'MODULE_NOT_FOUND',
 requireStack: []
 }

So I have tried different variations in the package.json within the start:prod command but cant get it to build complete

/
/dist/main
../dist/main

Does anyone have any experience with getting this to work?


Solution

  • start:prod sounds like it should be set to node dist/src/main. This usually is the case when there is a file from outside of src being compiled with src, and Typescript is maintaining the directory structure in the output directory.