#Typescript build fails - incorrect type inference
53 messages · Page 1 of 1 (latest)
Project ID: N/A
Interesting. What version of Nixpacks did it last work?
Locally with nixpacks?
I am having issues building the repo locally (without Nixpacks).
It seems like the repo needs a very specific version Node (18.13 doesn't work but 18.15 gets further in the build?). I see the typescript error when using Nixpacks locally, but being unable to get it to build locally without Nixpacks makes me think that it is a code issue
Yes
Ah ok but it’s fine building with tsc in a local environment?
What node version are you using
So builds locally without NixPacks
Fails to build locally with NixPacks
What node version
Without NixPacks 18.15 or 18.16 work
With NixPacks I can only get 18.12
Do you use any global packages
Dockerfile will fix that issue
You mean build using Dockerfile? Yeah sure, but this is not my goal coming here 😅
thats fair, might be best to fix the code issue than
Yeah I mean that will fix the problem but like jr said if you need a specific version it might be a code issue
or code incompatibilities
alex sleeps and breaths ts
oof
@scenic gate and @hearty blaze
Here is the correct type of an object:
What is the error tho
here is the error:
#13 2.761 web:build: info - Linting and checking validity of types...
#13 14.64 web:build: Failed to compile.
#13 14.64 web:build:
#13 14.64 web:build: ./pages/menu/[restaurant].tsx:74:81
#13 14.64 web:build: Type error: Property 'id' does not exist on type '{ readonly content: readonly { readonly locale: "en" | "he"; readonly name: string; readonly description: Option<string>; }[]; readonly modifiers: readonly {}[]; }'.
#13 14.64 web:build:
#13 14.64 web:build: 72 | <Category.Section key={category.id} category={category}>
#13 14.64 web:build: 73 | <Category.Items>
#13 14.64 web:build: > 74 | {category.categoryItems.map((ci) => <Category.Item key={ci.item.id} item={ci} />)}
#13 14.64 web:build: | ^
#13 14.64 web:build: 75 | </Category.Items>
#13 14.64 web:build: 76 | </Category.Section>
#13 14.64 web:build: 77 | ))}
#13 14.81 web:build: ELIFECYCLE Command failed with exit code 1.
#13 14.83
#13 14.83 Tasks: 1 successful, 2 total
#13 14.83 Cached: 0 cached, 2 total
#13 14.83 Time: 14.374s
#13 14.83
#13 14.83 web:build: ERROR: command finished with error: command (/app/apps/web) pnpm run build exited (1)
#13 14.83 command (/app/apps/web) pnpm run build exited (1)
#13 14.83 ERROR run failed: command exited (1)
#13 14.84 ELIFECYCLE Command failed with exit code 1.
exactly, it something very odd and does not make sense
This is due to the Nixpkgs archive being an older version. You can change it via a nixpacks.toml file. For example
[phases.setup]
nixpkgsArchive = 'f2e9a130461950270f87630b11132323706b4d91'
Although I don't know why the node version would be causing a TypeScript error
It shouldn’t
That’s the thing
Any 18.xx should be compatible with any 18.xx code
would that bring a new Node version @jr, I can try it
But as @scenic gate mentioned, I do not think it is a node verion
18.12 builds fine outside NixPacks
Could it be an environment variable? Nixpacks sets the following for now
NODE_ENV=productionNPM_CONFIG_PRODUCTION=false
nope, already tried those env vars, work fine outside nixpacks
not sure what you need clarification on, but it builds fine outside nixpacks with NODE_ENV=production NPM_CONFIG_PRODUCTION=false
spent a long time trying to make sure everything is exactly the same
it's like this advanced TS is just falling over inside docker. some type of resource constraint?
Hmm I'm really not sure. I still suspect it is a version issue. TypeScript is completing successfully, but it just has the wrong information and is reporting an error when it shouldn't
Do you have a Dockerfile that works to build the project? I am trying
FROM node:18-alpine
WORKDIR /app
COPY . /app
RUN npm install -g corepack && corepack enable
RUN pnpm i --frozen-lockfile
RUN pnpm run build
But am seeing this error
Hashing error: cannot find package-file hash for eslint-config-custom#*.config.mjs!db/**/*.ts!integrations/**/*.ts!mailers/**/*.ts!package.json!pages/**/*.ts!*.config.js!pages/**/*.tsx!src/**/*.js!src/**/*.jsx!src/**/*.ts!src/**/*.tsx!tsconfig.json
#10 26.52 Hashing error: cannot find package-file hash for tsconfig#*.config.mjs!db/**/*.ts!integrations/**/*.ts!mailers/**/*.ts!package.json!pages/**/*.ts!*.config.js!pages/**/*.tsx!src/**/*.js!src/**/*.jsx!src/**/*.ts!src/**/*.tsx!tsconfig.json
I was able to reproduce the issue here:
FROM node:18-buster
WORKDIR /app
COPY . /app
RUN npm install -g corepack && corepack enable
RUN pnpm i --frozen-lockfile
RUN pnpm run build --filter web
I am getting the same error as NixPacks
Core pack is installed by default isn’t it?
