R
Railway•13mo 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•13mo ago
Project ID: ff888312-fff1-42e2-bb27-6d6f628e7d3b
Dohyu
DohyuOP•13mo ago
ff888312-fff1-42e2-bb27-6d6f628e7d3b
Brody
Brody•13mo ago
do you also have a package lock file?
Dohyu
DohyuOP•13mo ago
There is a bug in the "backend" service and the "yeondocs-web" service. no Never
Brody
Brody•13mo ago
do you have your root directory set to a subfolder in the service settings?
Dohyu
DohyuOP•13mo ago
No description
Dohyu
DohyuOP•13mo ago
Both the "backend" service and the "yeondocs-web" service have root directories set in settings.
Solution
Brody
Brody•13mo 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
DohyuOP•13mo ago
I'll try it Oh nixpacks run "pnpm i " finally Thanks
Brody
Brody•13mo ago
did you already have those two scripts I mentioned?
Dohyu
DohyuOP•13mo ago
Yes
Brody
Brody•13mo ago
ah cool, so you where already like 90% of the way there
Dohyu
DohyuOP•13mo ago
The problem was only because the root directory was set. Thank you very much
Brody
Brody•13mo ago
yeah railways docs on monorepos could be better
Dohyu
DohyuOP•13mo ago
It was my mistakes.
Brody
Brody•13mo 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
DohyuOP•13mo ago
" yeondocs-web" is a web app for frontend.
Brody
Brody•13mo ago
hosted on railway too?
Dohyu
DohyuOP•13mo ago
yeah
Brody
Brody•13mo ago
vite?
Dohyu
DohyuOP•13mo ago
No Next.js app
Brody
Brody•13mo 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
DohyuOP•13mo ago
Thank you so much for your kind reply
Brody
Brody•13mo ago
no problem 🙂
Mark Khoo
Mark Khoo•11mo 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•11mo 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•11mo ago
yea the command is just pnpm turbo build --filter=appname
Brody
Brody•11mo ago
perfect, use that kind of syntax in your build:<appname> and start:<appname> commands
Mark Khoo
Mark Khoo•11mo ago
oh wait I see... we want this command as a script in the root
Brody
Brody•11mo ago
yes
Mark Khoo
Mark Khoo•11mo 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•11mo ago
let's see what you have for your scripts in the package.json at the root of your project?
Mark Khoo
Mark Khoo•11mo 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•11mo ago
that is cursed, you do still have the root directory set to / right?
Mark Khoo
Mark Khoo•11mo ago
yea or maybe I have to do some railway configuration magic?
Brody
Brody•11mo ago
do you have dotnet stuff in the root of your repo?
Mark Khoo
Mark Khoo•11mo ago
no it's a actually in the directory /apps
Brody
Brody•11mo 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•11mo ago
that's what im trying to figure out right now
Brody
Brody•11mo 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•11mo ago
this is where my brain is right now
Brody
Brody•11mo ago
or you have overridden the providers list somewhere
Mark Khoo
Mark Khoo•11mo ago
i have no idea what that is 😅
Brody
Brody•11mo ago
fair, but that doesn't mean you haven't changed them
Mark Khoo
Mark Khoo•11mo ago
how do i see the providers list?
Brody
Brody•11mo ago
service settings most likely
Mark Khoo
Mark Khoo•11mo 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•11mo ago
probably because you're not beta open the command pallet and search for join
Mark Khoo
Mark Khoo•11mo ago
what is the command pallet?
Brody
Brody•11mo ago
ctrl / cmd + k
Mark Khoo
Mark Khoo•11mo ago
oh got it i joined i think
Brody
Brody•11mo ago
you did
Mark Khoo
Mark Khoo•11mo ago
providers is still hidden for me but breifly revealing it shows Node
Brody
Brody•11mo ago
what does the build table show?
Mark Khoo
Mark Khoo•11mo ago
No description
Brody
Brody•11mo ago
the build table is in the build logs
Mark Khoo
Mark Khoo•11mo ago
No description
Brody
Brody•11mo ago
do you think you could open a new help thread for this?
Mark Khoo
Mark Khoo•11mo ago
sure thing
Want results from more Discord servers?
Add your server