First of all: windows user here 😄
When I run pnpm build in the repo root, most of the time I get:
Tasks: 3 successful, 25 total
Cached: 0 cached, 25 total
Time: 19.131s
Failed: @ai-sdk/anthropic#build
ERROR run failed: command exited (1)
ELIFECYCLE Command failed with exit code 1.
There are no additional error messages or logs. The failing package changes randomly (each run fails in a different package), so I’ll refer to it as "errored-package" below.
At first, I suspected the issue might be related to Turborepo, but:
I can reproduce the same failure by running pnpm build inside packages/errored-package directly. Out of 10 runs, about 5 fail — in random order.
➡️ So it’s not Turbo’s fault.
Lets take test-server as an example as it doesnt have any workspace dependencies besides the tsconfig.
I changed the build script from:
"scripts": {
"build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
...
to:
"scripts": {
"build": "tsup --tsconfig tsconfig.build.json",
...
This eliminates clean or &&–related issues. ➡️ The problem is still reproducible.
When the build succeeds, the output looks like this:
CLI Building entry: src/index.ts
CLI Using tsconfig: tsconfig.build.json
CLI tsup v8.3.0
CLI Using tsup config: C:\GIT\ai\packages\test-server\tsup.config.ts
CLI Building entry: src/with-vitest.ts
CLI Using tsconfig: tsconfig.build.json
CLI tsup v8.3.0
CLI Using tsup config: C:\GIT\ai\packages\test-server\tsup.config.ts
CLI Target: es2018
CJS Build start
ESM Build start
CLI Target: es2020
CJS Build start
ESM Build start
CJS dist\index.js 6.57 KB
CJS dist\index.js.map 11.10 KB
CJS ⚡️ Build success in 33ms
CJS dist\with-vitest.js 6.89 KB
CJS dist\with-vitest.js.map 12.58 KB
CJS ⚡️ Build success in 31ms
ESM dist\index.mjs 5.41 KB
ESM dist\index.mjs.map 10.89 KB
ESM ⚡️ Build success in 36ms
ESM dist\with-vitest.mjs 5.71 KB
ESM dist\with-vitest.mjs.map 12.53 KB
ESM ⚡️ Build success in 33ms
DTS Build start
DTS Build start
DTS ⚡️ Build success in 1320ms
DTS dist\index.d.ts 2.05 KB
DTS dist\index.d.mts 2.05 KB
DTS ⚡️ Build success in 1474ms
DTS dist\with-vitest.d.ts 2.01 KB
DTS dist\with-vitest.d.mts 2.01 KB
When the build fails, the output ends like this:
CLI Building entry: src/index.ts
CLI Using tsconfig: tsconfig.build.json
CLI tsup v8.3.0
CLI Using tsup config: C:\GIT\ai\packages\test-server\tsup.config.ts
CLI Building entry: src/with-vitest.ts
CLI Using tsconfig: tsconfig.build.json
CLI tsup v8.3.0
CLI Using tsup config: C:\GIT\ai\packages\test-server\tsup.config.ts
CLI Target: es2018
CJS Build start
ESM Build start
CLI Target: es2020
CJS Build start
ESM Build start
CJS dist\index.js 6.57 KB
CJS dist\index.js.map 11.10 KB
CJS ⚡️ Build success in 27ms
CJS dist\with-vitest.js 6.89 KB
CJS dist\with-vitest.js.map 12.58 KB
CJS ⚡️ Build success in 29ms
ESM dist\index.mjs 5.41 KB
ESM dist\index.mjs.map 10.89 KB
ESM ⚡️ Build success in 34ms
ESM dist\with-vitest.mjs 5.71 KB
ESM dist\with-vitest.mjs.map 12.53 KB
ESM ⚡️ Build success in 33ms
ELIFECYCLE Command failed.
Notice 2 things:
dist folder contains no .d.ts or .d.mts files.DTS Build start appears twice in the console output (which matches the tsup.config.ts, since it defines two entries).Checking the tsup repo I noticed the following note:
This project is not actively maintained anymore. Please consider using tsdown instead. Read more in the migration guide.
I followed the migration guide and replaced tsup with tsdown, and after doing so I have not been able to reproduce the issue anymore.
Given how widely this repository is used, I’m genuinely surprised that I seem to be the only one running into this issue. It might be related to the operating system — I’m on Windows 11 — but I’m not entirely sure.
Current main branch with: