Turborepo deploy getting TSC: Not Found
Trying to deploy the API package in my shared turborepo.
Project ID: 479b4418-bb9f-403c-a4f1-5c24cd09b7ea
The deployment is failing because tsc: not found.
Similar to https://discord.com/channels/713503345364697088/1052194289985273966/1052194289985273966
93 Replies
Project ID:
N/A
okay now show me your package.json please
root or child-package ?
the entire file please
There are multiple package.json's
One for each package, and one in the monorepo's root. Which would you like me to share, the service or the root package json
the package.json for the service that's giving you troubles
@Brody
I don't see tsc listed in the dependencies list? I do see tsup though, maybe you where in the middle of switching over to tsup?
(I've heard tsup is better than tsc)
so we have typescript in our root package dependencies. i just added it to the dependencies of this service/package, but still getting the same error below
in fact, we use them both π€¦ββοΈ
that's not the full build logs, for future reference, to send full log files you'd want to create a .txt file and copy all log lines into that file
hm yea the log-text highlight seems to get truncated when it's long
send the updated package.json?
just added tsc as it's own dependency to see if it resolves
hmmm I still don't see tsc in the dependencies?
oh it gets installed with typescript
npm
tsc
A deprecated release of the TypeScript compiler. Latest version: 2.0.4, last published: a year ago. Start using tsc in your project by running
npm i tsc
. There are 490 other projects in the npm registry using tsc.my bad
right
anyway to install typescript globally?
through nixPkgs or so?
should you need to though? doesn't npm prefix the scripts with npx so that you could run tsc from the install in node_modules?
uh im not convinced it does actually
prefix it yourself?
i did previously though i think because it isn't installing something is off, let me get you those error logs
maybe this might work?
trying
^^ the error message when i ran npx without pointing to ts package like you suggested
now try with it pointing to the package
also @Brody im noticing that even though I've added my engines definitions in the package lock, it's not respecting them
yes, you can only specify major versions
noted.
okay @Brody
seems to fail to install typescript in the first place
let me bump the version listed
everything always has to be so difficult with typescript
and just a friendly reminder, theres no need for pings - #πο½readme #5
apologies brotha
any success? i can just give you something that will install ts globally for the shotgun approach
let's do it
no luck
give me your current railway.json please
empty
where do i export it from
the details tab
sorry, the details tab under which screen? maybe i don't have one yet since there's no successful deploy?
failed should still have it
found it
did you say this was a monorepo, or a turborepo
we use turbo to compile
then railway would only be installing the deps in your root's package.json
damn
since by default railway uses the root directory, and thus its using the package.json in the root directory
i imagine there's some voodoo causing it to have issues, though my root package.json does have typescript in the devdependencies
NODE_ENV would be set to production when on railway, so npm ci wouldnt install typescript
so if we were using lerna or some monorepo type to compile we'd be okay?
is there any suggestion that doesn't involve regressing to lerna?
okay so lets say i just cloned your repo, starting from the root directory what would be the commands i would run to get this app fully operational
after installing the external dependencies like mongo, node etc.
simply
npm i
npm run compile
npm run dev
nothing fancy
from the root
seems too simple to work
i wouldn't lie to you
turbo handles the build for all the separate packages
how is
npm i
in the root directory installing deps from a package.json in a sub dirthe workspaces in the package.json
i believe
can i take a look at your repo?
unfortunately im not authorized to give you access
but the structure is something like
package.json
packages
|- package a
|- - package.json
|- package b
|- - package.json
...
Contents for the root package.json here
and the previous examples are one of (namely, maitred) these packages
wait this thread says monorepo, is it a mono or turbo?
100% turbo
sorry we use those interchangeably
appreciate ya
i did have it in the description
and how many sub packages are there
a tonne lol
say around 15-20
in fact it's more
π
it's why we use turbo
otherwise it'd be unbearable
hence why I'd call it a regression
you also did get bad engine errors?
well im really sorry but my knowledge on the subject has ran out π¦
cc @aleks
Could you send your Dockerfile?
No dockerfile, this is with Nixpacks
oh nevermind I was looking at the wrong thing, sorry
hmm
@aleks the service package.json
and the root package.json
The good news here is that the Node engine issue is gone
But just can't find TSC x_x
Could you send the Nixpacks plan table? (at the top of the build logs)
I got you
try removing the
--prefix
from the build command?okay but then it'd just build the whole project no?
I guess so, never mind then
hmm
oh
try
npx turbo maitred:compile
insteadokay trying
And then the start command should be able to be left at the Railway default, since it'll look for a
start
script by default - just set NIXPACKS_TURBO_APP_NAME
to maitred
in your environment variables.
Could you rename your compile
script to build
? That'll allow the default options to work.i thought turbo targets the package differently
--scope
not familiar with the maitred:compile command
If you can rename your
compile
script to build
, you can remove all custom configurationok
it should be
<package name>:<script>
, also - I just checked the Nixpacks codebase
(unless it's changed since that was written)Yea, its calling that correctly
so npx turbo compile package-name:script can't find any tasks
--scope does target the package
it may be outdated syntax
sorry, I was unclear
npx turbo maitred:compile
I think that got deprecated
They now want you to use: https://turbo.build/repo/docs/core-concepts/monorepos/filtering
I stand corrected, sorry
Is this still an issue? I believe the problem is that there are a bunch of
"cacheDirectories"
in the package.json
file. Removing that should work
It is not recommended to cache node_modules directories directly. Especially in Nixpacks since those folders will not be available in the final image and they contain runtime dependenciesit was the cacheDirectories it seems - got the service up and running π₯ appreciate the support