Andrew D
Andrew D
RRailway
Created by Andrew D on 6/19/2023 in #✋|help
NestJS Monorepo: Cannot find module '/app/dist/apps/server/main' on server start
Ahh, there we go! Looks like changing the start script to "server:start:prod": "node dist/apps/server/main.js" did the trick! Thank you for the help!
13 replies
RRailway
Created by Andrew D on 6/19/2023 in #✋|help
NestJS Monorepo: Cannot find module '/app/dist/apps/server/main' on server start
railway.json:
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"buildCommand": "npm run server:build",
"watchPatterns": []
},
"deploy": {
"numReplicas": 1,
"startCommand": "npm run server:start:prod",
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"buildCommand": "npm run server:build",
"watchPatterns": []
},
"deploy": {
"numReplicas": 1,
"startCommand": "npm run server:start:prod",
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
package.json scripts:
"scripts": {
...
"server:build": "nest build",
"server:start:prod": "node dist/main.js",
...
},
"scripts": {
...
"server:build": "nest build",
"server:start:prod": "node dist/main.js",
...
},
But still unfortunately not finding the correct path:
> [email protected] server:start:prod
> node dist/main.js
node:internal/modules/cjs/loader:988
throw err;
^
Error: Cannot find module '/app/dist/main.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833: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: []
}
> [email protected] server:start:prod
> node dist/main.js
node:internal/modules/cjs/loader:988
throw err;
^
Error: Cannot find module '/app/dist/main.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833: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: []
}
13 replies
RRailway
Created by Andrew D on 6/19/2023 in #✋|help
NestJS Monorepo: Cannot find module '/app/dist/apps/server/main' on server start
Oh gotcha! Tyvm, will give that a shot 🙂
13 replies
RRailway
Created by Andrew D on 6/19/2023 in #✋|help
NestJS Monorepo: Cannot find module '/app/dist/apps/server/main' on server start
@brody192 Thank you for the response! Can you elaborate on #1 a little?
13 replies
RRailway
Created by Andrew D on 6/19/2023 in #✋|help
NestJS Monorepo: Cannot find module '/app/dist/apps/server/main' on server start
2bc44233-73d7-49db-97bb-7fd40351d89b
13 replies