a year ago
I am trying to deploy the code with prod env but getting error because it is auto deploy with npm run start
how to run npm run start:prod or start:dev in railway.app instead npm run start
ⓘ Deployment information is only viewable by project members and Railway employees.
6 Replies
a year ago
repositree-micro-svc-starter@0.0.1 build:prod
Jun 13 01:35:10
> cross-env NODE_ENV=production nest build
Jun 13 01:35:11
node:events:495
Jun 13 01:35:11
throw er; // Unhandled 'error' event
Jun 13 01:35:11
^
Jun 13 01:35:11
Error: spawn nest ENOENT
Jun 13 01:35:11
at ChildProcess._handle.onexit (node:internal/child_process:284:19)
Jun 13 01:35:11
at onErrorNT (node:internal/child_process:477:16)
Jun 13 01:35:11
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Jun 13 01:35:11
Emitted 'error' event on ChildProcess instance at:
Jun 13 01:35:11
at ChildProcess._handle.onexit (node:internal/child_process:290:12)
Jun 13 01:35:11
at onErrorNT (node:internal/child_process:477:16)
Jun 13 01:35:11
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
Jun 13 01:35:11
errno: -2,
Jun 13 01:35:11
code: 'ENOENT',
Jun 13 01:35:11
syscall: 'spawn nest',
Jun 13 01:35:11
path: 'nest',
Jun 13 01:35:11
spawnargs: [ 'build' ]
Jun 13 01:35:11
}
Jun 13 01:35:11
Node.js v18.20.2
Jun 13 01:35:11
error building image: error building stage: failed to execute command: waiting for process to exit: exit status 1
Jun 13 01:35:11
exit status 1I am getting error in deployment
a year ago
my toml file# railway.toml
[build]
builder = "NIXPACKS"
buildCommand = "npm install && npm install -g @nestjs/cli && npm run build:prod"
buildEnvironment = "V2"
[deploy]
runtime = "UNSPECIFIED"
numReplicas = 1
startCommand = "npm run start:prod"
sleepApplication = false
restartPolicyType = "ON_FAILURE"
restartPolicyMaxRetries = 2
[deploy.env]
NODE_ENV = "production"
# Add any other environment variables your application needs
[build.environment]
NODE_VERSION = "18.x"
6 months ago
hi brody, can we use "npm install && npm run build" in custom build command?
6 months ago
npm ci
and npm run build
are ran automatically for you.
Additionally, please open your own thread as your question does not pertain to the original topic.
Status changed to Closed brody • 6 months ago