5 months ago
Hi, i'm trying to run the B2B template from here (https://github.com/medusajs/b2b-starter-medusa), but i'm getting:
#10 [stage-0 6/10] RUN --mount=type=cache,id=s/7ccf675d-cbf9-4463-8502-b321da1cb537-/root/npm,target=/root/.npm yarn install
Package.json
{
"name": "my-monorepo",
"private": true,
"scripts": {
"setup": "yarn build-packages && yarn setup-db && yarn seed && yarn setup-user",
"dev": "turbo run dev",
"build-packages": "turbo run build --filter ./packages/*",
"setup-db": "cd ./apps/backend && npx medusa db:create && npx medusa db:migrate",
"seed": "turbo run seed --filter=medusa-starter-default",
"setup-user": "cd ./apps/backend && npx medusa user -e admin@test.com -p supersecret -i admin",
"generate-env": "cp ./apps/backend/.env.template ./apps/backend/.env && cp ./apps/storefront/.env.template ./apps/storefront/.env",
"start": "turbo run start",
"lint": "turbo run lint"
},
"packageManager": "yarn@4.5.0",
"devDependencies": {
"turbo": "latest",
"typescript": "latest"
},
"workspaces": [
"apps/*",
"packages/*"
],
"engines": {
"node": ">=20",
"yarn": ">=1.22"
}
}
And i even added railway.json file:
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"buildCommand": "yarn setup",
"nixpacksPlan": {
"phases": {
"install": {
"dependsOn": ["setup"],
"cmds": ["yarn install"]
}
}
}
},
"deploy": {
"startCommand": "yarn start",
"numReplicas": 1,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
Any ideas?
0 Replies
5 months ago
hello, thats not a project id
5 months ago
yep
I ejected the project to my repo https://github.com/kompraventa/b2b-starter-medusa
5 months ago
did the template work before you ejected?
Actually yes, i'll resolve the issue. I'm getting "could not find task start" but that's another issue
On forked/ejected untouched repo i'm getting now
#11 1.732 ➤ YN0000: │ "@algolia/cache-browser-local-storage@npm:4.24.0":
#11 1.732 ➤ YN0000: │ version: 4.24.0
#11 1.732 ➤ YN0000: │ resolution: "@algolia/cache-browser-local-storage@npm:4.24.0"
#11 1.732 ➤ YN0000: │
#11 1.732 ➤ YN0028: │ The lockfile would have been modified by this install, which is explicitly forbidden.
#11 1.732 ➤ YN0000: └ Completed
#11 1.732 ➤ YN0000: · Failed with errors in 0s 761ms
#11 ERROR: process "/bin/bash -ol pipefail -c yarn install --frozen-lockfile" did not complete successfully: exit code: 1
-----
> [stage-0 7/9] RUN --mount=type=cache,id=s/2f921a83-4d00-453d-9890-f9671610ffd0-/usr/local/share/cache/yarn/v6,target=/usr/local/share/.cache/yarn/v6 yarn install --frozen-lockfile:
5 months ago
can you link to the template please
This is a new project id where build passes but seems there's problem with turbo
5 months ago
^
Sorry, this? https://github.com/kompraventa/b2b-template
5 months ago
the railway template
I'm not using a template, i was looking at this https://railway.app/template/gkU-27 but now i want to make similar setup but for B2B store, this template is for normal B2C
5 months ago
you said ejected, that terminology is specific to when you had deployed from a template
I'm not sure why previous one didn't work, it was an eject from template, and this one is a github fork
5 months ago
what template
5 months ago
what you have in your project is not what the template is
This project
Was created from template
But this one
Was created from scratch, i created an empty project and connected it to the forked repo (https://github.com/kompraventa/b2b-template)
5 months ago
have you tried setting the root directory's
I didn't try, not sure what to put there since instructions from origin repo (https://github.com/medusajs/b2b-starter-medusa?tab=readme-ov-file#quickstart) says to run
yarn install && yarn setup
From root. Now if i set root dir it won't work, i assume. This command runs both backend and storefront (frontend), port 9000 and 8000 respectively.
5 months ago
the template you linked has root directories set
Yes but the creator made it custom irrelevant from B2B case, they only have backend and frontend dirs in the root, it's not a monorepo
5 months ago
what command starts just the backend server?
5 months ago
you do not want to be using cd
5 months ago
you need a command that starts the backend
5 months ago
same for the frontend service
5 months ago
once you have those, set them on the service settings
In the root of monorepo in its package.json there's
"start": "turbo run start"
Which runs start on both backend and frontend somehow, unfortunately my knowledge on turbo is limited, i'm not sure how it does that
5 months ago
you need a command that only runs the backend