Error: Cannot find module '/app/dist/server.js'
9 months ago
I have the following isolated monorepo structure :
/-packages
- / api
- / app
But i'm just trying to deploy the api on railway only,. I've set the root directory to /packages/api/
and start command to `node dist/server.js` each time it tries redeploying i keep getting the error message in the title above. Any idea how this can be resolved?
3 Replies
9 months ago
Does the package.json in your API folder have a build script?
If it doesn't you would need one so that the dist folder is built.
9 months ago
Yes it does.
"scripts": {
"dev": "nodemon --exec node -r tsconfig-paths/register --no-warnings=ExperimentalWarning --loader ts-node/esm ./src/server.ts",
"generate": "prisma generate",
"build": "CI=false rimraf ./dist && tsc",
"dbPush": "prisma db push",
"migrate": "prisma migrate dev",
"start": "node dist/server.js",
"watch": "tsc --watch",
"format": "npx prettier --write .",
"db:studio": "npx prisma studio",
"inngest": "npx inngest-cli@latest dev -u http://localhost:4001/api/inngest"
},
9 months ago
How have you confirmed that the files are in fact being created?
Nixpacks or Dockerfile?