R
Railway•7mo ago
Dohyu

Nixpacks ignores root "pnpm-lock.yaml" and runs "npm i"

I have "pnpm-lock.yaml" in my root directory, but Nixpack s runs "npm i" to install dependencies. Please help.
Solution:
for a turbo repo, you want to first have two sets of build and start commands in your package.json (at the root), for example (for the backend) a build:backend that only builds the backend, and a start:backend that only starts the backend, you leave the root directory service setting empty, and then set those two build and start commands in the service settings, pnpm run build:backend and pnpm run start:backend
Jump to solution
59 Replies
Percy
Percy•7mo ago
Project ID: ff888312-fff1-42e2-bb27-6d6f628e7d3b
Dohyu
Dohyu•7mo ago
ff888312-fff1-42e2-bb27-6d6f628e7d3b
Brody
Brody•7mo ago
do you also have a package lock file?
Dohyu
Dohyu•7mo ago
There is a bug in the "backend" service and the "yeondocs-web" service. no Never
Brody
Brody•7mo ago
do you have your root directory set to a subfolder in the service settings?
Dohyu
Dohyu•7mo ago
No description
Dohyu
Dohyu•7mo ago
Both the "backend" service and the "yeondocs-web" service have root directories set in settings.
Solution
Brody
Brody•7mo ago
for a turbo repo, you want to first have two sets of build and start commands in your package.json (at the root), for example (for the backend) a build:backend that only builds the backend, and a start:backend that only starts the backend, you leave the root directory service setting empty, and then set those two build and start commands in the service settings, pnpm run build:backend and pnpm run start:backend
Dohyu
Dohyu•7mo ago
I'll try it Oh nixpacks run "pnpm i " finally Thanks
Brody
Brody•7mo ago
did you already have those two scripts I mentioned?
Dohyu
Dohyu•7mo ago
Yes
Brody
Brody•7mo ago
ah cool, so you where already like 90% of the way there
Dohyu
Dohyu•7mo ago
The problem was only because the root directory was set. Thank you very much
Brody
Brody•7mo ago
yeah railways docs on monorepos could be better
Dohyu
Dohyu•7mo ago
It was my mistakes.
Brody
Brody•7mo ago
you can also use watch paths so that you don't trigger a new build of the backend when pushing frontend code to github, or vice versa https://docs.railway.app/deploy/builds#watch-paths what kind of app is the yeondocs-web app?
Dohyu
Dohyu•7mo ago
" yeondocs-web" is a web app for frontend.
Brody
Brody•7mo ago
hosted on railway too?
Dohyu
Dohyu•7mo ago
yeah
Brody
Brody•7mo ago
vite?
Dohyu
Dohyu•7mo ago
No Next.js app
Brody
Brody•7mo ago
ah cool, then you're all set, I was asking because railway doesn't have great support for static spa apps, but all good since it's next
Dohyu
Dohyu•7mo ago
Thank you so much for your kind reply
Brody
Brody•7mo ago
no problem 🙂
Mark Khoo
Mark Khoo•5mo ago
might be a dumb question but what would the build:<appname> and start:<appname> commands in the root package.json look like? My turborepo apps only have a build command...
Brody
Brody•5mo ago
i could be wrong, im not a js dev, but i think turbo has a filter flag that will allow you to run specific scripts within a given package/app
Mark Khoo
Mark Khoo•5mo ago
yea the command is just pnpm turbo build --filter=appname
Brody
Brody•5mo ago
perfect, use that kind of syntax in your build:<appname> and start:<appname> commands
Mark Khoo
Mark Khoo•5mo ago
oh wait I see... we want this command as a script in the root
Brody
Brody•5mo ago
yes
Mark Khoo
Mark Khoo•5mo ago
alright let me try some things I need a start command but im not sure what that start command is supposed to be 😅
Brody
Brody•5mo ago
let's see what you have for your scripts in the package.json at the root of your project?
Mark Khoo
Mark Khoo•5mo ago
I did a little more figuring out and this is going to sound pretty cursed but there is a dotnet app in the apps directory of the turbo repo... so Nixpacks is trying to build that instead of detecting the turbo.json... I think I need to tackle this before I move any further.
Brody
Brody•5mo ago
that is cursed, you do still have the root directory set to / right?
Mark Khoo
Mark Khoo•5mo ago
yea or maybe I have to do some railway configuration magic?
Brody
Brody•5mo ago
do you have dotnet stuff in the root of your repo?
Mark Khoo
Mark Khoo•5mo ago
no it's a actually in the directory /apps
Brody
Brody•5mo ago
so why would railway know about that unless you set the root directory to /app? railway doesn't check the subdirectories
Mark Khoo
Mark Khoo•5mo ago
that's what im trying to figure out right now
Brody
Brody•5mo ago
if you have the service's root directory set to / then you must have something in the root thats making nixpacks think its a dotnet app
Mark Khoo
Mark Khoo•5mo ago
this is where my brain is right now
Brody
Brody•5mo ago
or you have overridden the providers list somewhere
Mark Khoo
Mark Khoo•5mo ago
i have no idea what that is 😅
Brody
Brody•5mo ago
fair, but that doesn't mean you haven't changed them
Mark Khoo
Mark Khoo•5mo ago
how do i see the providers list?
Brody
Brody•5mo ago
service settings most likely
Mark Khoo
Mark Khoo•5mo ago
its should be in the build section section in the service settings but it's hidden... I see it in the DOM but it isn't visible. Is this because Nixpacks is the default builder?
Brody
Brody•5mo ago
probably because you're not beta open the command pallet and search for join
Mark Khoo
Mark Khoo•5mo ago
what is the command pallet?
Brody
Brody•5mo ago
ctrl / cmd + k
Mark Khoo
Mark Khoo•5mo ago
oh got it i joined i think
Brody
Brody•5mo ago
you did
Mark Khoo
Mark Khoo•5mo ago
providers is still hidden for me but breifly revealing it shows Node
Brody
Brody•5mo ago
what does the build table show?
Mark Khoo
Mark Khoo•5mo ago
No description
Brody
Brody•5mo ago
the build table is in the build logs
Mark Khoo
Mark Khoo•5mo ago
No description
Brody
Brody•5mo ago
do you think you could open a new help thread for this?
Mark Khoo
Mark Khoo•5mo ago
sure thing