8 months ago
Hello. My name Max. I have got project React Nodejs Postgresql. My client side working, database i connect and it work too. But backend have a problem. Local project work good. Can you help me please? I have got local nodejs 20.17.0 postgresql 16.
west1]
==============
Using Nixpacks
==============
context: f9ac8993be886878eb24857ea9aa83cd
╔════════ Nixpacks v1.29.0 ═══════╗
║ setup │ nodejs_18, npm-9_x ║
║─────────────────────────────────║
║ install │ npm ci ║
║─────────────────────────────────║
║ build │ npm run prod ║
║─────────────────────────────────║
║ start │ npm run dev ║
╚═════════════════════════════════╝
#0 building with "builder-IFDQ" instance using docker-container driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 2.12kB done
#1 DONE 0.0s
#2 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1727136237
#2 DONE 0.1s
#3 [stage-0 1/8] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1727136237@sha256:72cd12021740b1c4100a5c53c3b22974dacb86e4b0a35fcdd12605339de25b86
#3 resolve ghcr.io/railwayapp/nixpacks:ubuntu-1727136237@sha256:72cd12021740b1c4100a5c53c3b22974dacb86e4b0a35fcdd12605339de25b86 done
#3 DONE 0.0s
#4 [stage-0 4/10] RUN nix-env -if .nixpacks/nixpkgs-e05605ec414618eab4a7a6aea8b38f6fbbcc8f08.nix && nix-collect-garbage -d
#4 CACHED
#5 [stage-0 2/8] WORKDIR /app/
#5 CACHED
#6 [internal] load .dockerignore
#6 transferring context: 2B done
#6 DONE 0.0s
#7 [internal] load build context
#7 transferring context: 678.48kB 0.1s done
#7 DONE 0.1s
#8 [stage-0 3/10] COPY .nixpacks/nixpkgs-e05605ec414618eab4a7a6aea8b38f6fbbcc8f08.nix .nixpacks/nixpkgs-e05605ec414618eab4a7a6aea8b38f6fbbcc8f08.nix
#8 CACHED
#9 [stage-0 4/10] RUN nix-env -if .nixpacks/nixpkgs-e05605ec414618eab4a7a6aea8b38f6fbbcc8f08.nix && nix-collect-garbage -d
#9 CACHED
#10 [stage-0 5/10] COPY . /app/.
#10 DONE 0.1s
#11 [stage-0 6/10] RUN --mount=type=cache,id=s/02120dca-d728-46fb-b375-c0b79adcdabe-/root/npm,target=/root/.npm npm ci
#11 0.371 npm
WARN config production Use --omit=dev
instead.
#11 2.510 npm
WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
#11 2.542 npm WARN deprecated npmlog@5.0.1: This package is no longer supported.
#11 2.615 npm WARN deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
#11 2.670 npm WARN deprecated are-we-there-yet@2.0.0: This package is no longer supported.
#11 2.685 npm WARN deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
#11 2.792 npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
#11 2.831 npm WARN deprecated gauge@3.0.2: This package is no longer supported.
#11 5.470
#11 5.470 added 370 packages, and audited 371 packages in 5s
#11 5.470
#11 5.470 38 packages are looking for funding
#11 5.470 run npm fund
for details
#11 5.472
#11 5.472 found 0 vulnerabilities
#11 DONE 5.7s
#12 [stage-0 7/10] COPY . /app/.
#12 DONE 0.2s
#13 [stage-0 8/10] RUN --mount=type=cache,id=s/02120dca-d728-46fb-b375-c0b79adcdabe-node_modules/cache,target=/app/node_modules/.cache npm run prod
#13 0.361 npm
WARN config production Use --omit=dev
instead.
#13 0.410
#13 0.410 > backend@1.0.0 prod
#13 0.410 > npm install && npm run bootstrap
#13 0.410
#13 0.671 npm
WARN config production Use --omit=dev
instead.
#13 1.777
#13 1.777 up to date, audited 371 packages in 1s
#13 1.777
#13 1.777 38 packages are looking for funding
#13 1.777 run npm fund
for details
#13 1.779
#13 1.779 found 0 vulnerabilities
#13 2.049 npm
WARN config production Use --omit=dev
instead.
#13 2.100
#13 2.100 > backend@1.0.0 bootstrap
#13 2.100 > node ./bin/server.js
#13 2.100
#13 3.480 Listening on port 5000
#13 3.482 (node:43) NOTE: The AWS SDK for JavaScript (v2) is in maintenance mode.
#13 3.482 SDK releases are limited to address critical bug fixes and security issues only.
#13 3.482
#13 3.482 Please migrate your code to use AWS SDK for JavaScript (v3).
#13 3.482 For more information, check the blog post at https://a.co/cUPnyil
#13 3.482 (Use node --trace-warnings ...
to show where the warning was created)
Build timed out
6 Replies
8 months ago
You're trying to start the web application during build.
Remove the build command and then set your start command to start the production server.
8 months ago
Sorry. I not understand some. I have monorepo. My project se now /client, /backend and railway.json on root.
This is my /backend/package.json
"scripts": {
"dev": "nodemon ./bin/server.js",
"bootstrap": "node ./bin/server.js",
"prod": "npm install && npm run bootstrap"
},
And this is my /railway.json
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"nixpacksVersion": "1.21.2"
},
"deploy": {
"runtime": "V2",
"numReplicas": 1,
"startCommand": "npm run prod",
"sleepApplication": false,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
Backend
#12 3.492 Listening on port 5000
Nov 11 20:17:26
Nov 11 20:17:26
#12 3.494 (node:43) NOTE: The AWS SDK for JavaScript (v2) is in maintenance mode.
Nov 11 20:17:26
#12 3.494 SDK releases are limited to address critical bug fixes and security issues only.
Nov 11 20:17:26
#12 3.494
Nov 11 20:17:26
#12 3.494 Please migrate your code to use AWS SDK for JavaScript (v3).
Nov 11 20:17:26
#12 3.494 For more information, check the blog post at https://a.co/cUPnyil
Nov 11 20:17:26
#12 3.494 (Use node --trace-warnings ...
to show where the warning was created)
Nov 11 20:17:26
Nov 11 20:37:12
Nov 11 20:37:12
Build timed out
web-production-8926.up.railway.app
rror: Cannot find module 'express'
Nov 11 19:47:13
#12 46.04 Require stack:
Nov 11 19:47:13
#12 46.04 - /app/backend/app/index.js
Nov 11 19:47:13
#12 46.04 - /app/backend/bin/server.js
Nov 11 19:47:13
#12 46.04 at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
Nov 11 19:47:13
#12 46.04 at Module._load (node:internal/modules/cjs/loader:985:27)
Nov 11 19:47:13
#12 46.04 at Module.require (node:internal/modules/cjs/loader:1235:19)
Nov 11 19:47:13
#12 46.04 at require (node:internal/modules/helpers:176:18)
Nov 11 19:47:13
#12 46.04 at Object.<anonymous> (/app/backend/app/index.js:3:17)
Nov 11 19:47:13
#12 46.04 at Module._compile (node:internal/modules/cjs/loader:1376:14)
Nov 11 19:47:13
#12 46.04 at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
Nov 11 19:47:13
#12 46.04 at Module.load (node:internal/modules/cjs/loader:1207:32)
Nov 11 19:47:13
#12 46.04 at Module._load (node:internal/modules/cjs/loader:1023:12)
Nov 11 19:47:13
#12 46.04 at Module.require (node:internal/modules/cjs/loader:1235:19) {
Nov 11 19:47:13
#12 46.04 code: 'MODULE_NOT_FOUND',
Nov 11 19:47:13
#12 46.04 requireStack: [ '/app/backend/app/index.js', '/app/backend/bin/server.js' ]
Nov 11 19:47:13
#12 46.04 }
Nov 11 19:47:13
#12 46.04
Nov 11 19:47:13
#12 46.04 Node.js v21.1.0
Nov 11 19:47:13
Nov 11 19:47:13
#12 ERROR: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 1
Nov 11 19:47:13
Nov 11 19:47:14
-----
Nov 11 19:47:14
> [stage-0 8/10] RUN --mount=type=cache,id=s/9cf8cac5-8831-45ce-b005-d25307482510-node_modules/cache,target=/app/node_modules/.cache npm run build:
Nov 11 19:47:14
46.04 at Module._compile (node:internal/modules/cjs/loader:1376:14)
Nov 11 19:47:14
46.04 at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
Nov 11 19:47:14
46.04 at Module.load (node:internal/modules/cjs/loader:1207:32)
Nov 11 19:47:14
46.04 at Module._load (node:internal/modules/cjs/loader:1023:12)
Nov 11 19:47:14
46.04 at Module.require (node:internal/modules/cjs/loader:1235:19) {
Nov 11 19:47:14
46.04 code: 'MODULE_NOT_FOUND',
Nov 11 19:47:14
46.04 requireStack: [ '/app/backend/app/index.js', '/app/backend/bin/server.js' ]
Nov 11 19:47:14
46.04 }
Nov 11 19:47:14
46.04
Nov 11 19:47:14
46.04 Node.js v21.1.0
Nov 11 19:47:14
-----
Nov 11 19:47:14
Nov 11 19:47:14
Dockerfile:24
Nov 11 19:47:14
-------------------
Nov 11 19:47:14
22 | # build phase
Nov 11 19:47:14
23 | COPY . /app/.
Nov 11 19:47:14
24 | >>> RUN --mount=type=cache,id=s/9cf8cac5-8831-45ce-b005-d25307482510-node_modules/cache,target=/app/node_modules/.cache npm run build
Nov 11 19:47:14
25 |
Nov 11 19:47:14
26 |
Nov 11 19:47:14
-------------------
Nov 11 19:47:14
ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 1
Nov 11 19:47:14
Nov 11 19:47:14
Error: Docker build failed
Thank you for help!
8 months ago
Per my last message, remove the build command -
And then set your start command to start the production server.
Attachments
8 months ago
Thank you very much my friend. I wish you success!
8 months ago
Your custom domain is invalid and you are using nodemon, please never use nodemon in production.
8 months ago
Thank you very much for your help. Then I will try to recreate the server with custom domain. I think it will help me. Have a nice day my friend!
Status changed to Closed brody • 8 months ago