How to deploy api (nestjs) and web (nextjs) from monorepo
vinkaga
HOBBYOP

10 months ago

Hello,

I keep getting error

╭────────────────╮
│ Railpack 0.4.0 │
╰────────────────╯
 
↳ Detected Node
↳ Using npm package manager
↳ Installing npm@10.7.0 with Corepack
✖ 
No start command was found

The above error was for api deployment from the monorepo structured like this

root
|-- package.json
|-- apps
     |-- api
     |    |-- Dockerfile
     |    |-- railway.json
     |-- web
          |-- Dockerfile
          |-- railway.json

What am I doing wrong?

Solved$10 Bounty

Pinned Solution

vinkaga
HOBBYOP

10 months ago

Update:

1. I didn't create service specific package.json (more difficult to maintain).

  1. I had changed build and start commands but did not realize that I had to apply those changes before they take effect.
  2. Once I applied those changes, the no start command error went away.

9 Replies

Railway
BOT

10 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


vinkaga
HOBBYOP

10 months ago

I solved no start command issue by changing my .gitlab-ci.yml from

railway up --service api

to

cd apps/api && railway up --service api && cd ../..

But after that it's failing for docker issues. I haven't found a full solution yet. Any recommendations would be appreciated.


vinkaga
HOBBYOP

10 months ago

Looking at https://docs.railway.com/guides/monorepo#deploying-a-shared-monorepo, which reflects how my project is configured, I have the following questions

  1. Is there railway up involved? Which service would it specify?
  2. How do I exactly upload the code from .gitlab-ci.yml into railway?
  3. Do I have separate build commands for each service?
  4. Are the shared vars available during build?

vinkaga
HOBBYOP

10 months ago

Trying the approach in the document above.

.gitlab-ci.yml command

railway up --service api --detach

But back to no start command

↳ Detected Node
↳ Using npm package manager
↳ Installing npm@10.7.0 with Corepack
✖ 
No start command was found

.
 
To configure your start command, Railpack will check:
 
1. A "start" script in your package.json:
"scripts": {
"start": "node index.js"
}

irazvan2745
FREE

10 months ago

Hello,

You change the build and start commands to cd into the directories for each app in the monorepo


vinkaga
HOBBYOP

10 months ago

I don't have package.json in each app. Do I need to create one for each?


vinkaga
HOBBYOP

10 months ago

Update:

1. I didn't create service specific package.json (more difficult to maintain).

  1. I had changed build and start commands but did not realize that I had to apply those changes before they take effect.
  2. Once I applied those changes, the no start command error went away.

vinkaga

Update: 1\. I didn't create service specific package.json (more difficult to maintain). 1. I had changed build and start commands but **did not realize that I had to apply those changes before they take effect**. 2. Once I applied those changes, the `no start command` error went away.

10 months ago

So to clarify. This solved your issue?


vinkaga
HOBBYOP

10 months ago

Yes, it's solved. Thanks.


Status changed to Solved noahd 10 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...