Issue deploying Shared monorepo
victorseverin
HOBBYOP

4 months ago

Hi There
I'm having issues with deploying a shared monorepo. I have a Nextjs frontend service and a node backend as separate service. I have my build and start scripts in the root package.json. The build seems to work with no issues and the container starts fine. But then the app crashes because it can't find dist/server.js.
I've tried different variations of the build/start scripts and nothing seems to work.

Project ID: 0a5a93cc-7ff6-4770-8b9d-439fad66d7a9

|
|-- backend/
| |-- package.json
|--frontend
| |-- package.json
|--packages
| |--package.json
|--package.json
|--turbo.json

Root Package.json:
{
"name": "---",
"version": "1.0.0",
"private": true,
"packageManager": "npm@10.9.2",
"workspaces": [
"packages/*",
"frontend",
"backend"
],
"scripts": {
"dev": "turbo run dev",
"build": "turbo run build",
"build:backend": "turbo run build --filter=./backend",
"build:frontend": "turbo run build --filter=./frontend",
"start": "turbo run start",
"start:backend": "turbo run start --filter=./backend",
"start:frontend": "turbo run start --filter=./frontend",
"lint": "turbo run lint"
},
"devDependencies": {
"turbo": "^2.0.0"
}
}

$10 Bounty

1 Replies

b-sherqoziyev
HOBBY

4 months ago

The solution is to make sure the backend package.json has the build and start scripts correctly defined, and that the container starts in the correct directory so that dist/server.js can be found


Loading...