Cannot find module in the workspace?
See original GitHub issueWhat version of Turborepo are you using?
1.3.1
What package manager are you using / does the bug impact?
Yarn v1
What operating system are you using?
Mac
Describe the Bug
First of all, thank you for this amazing project. We’ve been enjoying using turborepo for the past 6 months and we love it so far!
I’m not sure if this is a bug report, but after digging into the issues and discussions, I couldn’t find anything near the problem we are currently facing and after triple checking the docs and a few hours of debug, we decided to open an issue ✋
We’re currently using Vercel and deploying an api using Fastify, we are using a similar setup than this one, we named it @acme/api
for the reproduction.
When trying to import another package (@acme/utils
) into the @acme/api
project, the project would not build:
NowBuildError: src/app.ts(2,23): error TS2307: Cannot find module '@acme/utils' or its corresponding type declarations.
I made the logs public, if it helps: https://turbo-vercel-repro-h8fvyigkv-blatty.vercel.app/_logs
And here’s our turbo.json
:
{
"$schema": "https://turborepo.org/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", "build/**", ".next/**", "public/**"]
},
"@acme/api#build": {
"dependsOn": ["^build", "@acme/utils#build"],
"outputs": ["dist/**", "build/**"]
},
"@acme/utils#build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"]
},
"start": {
"cache": false
},
"dev": {
"cache": false
}
},
"baseBranch": "origin/main",
"globalDependencies": ["$GITHUB_TOKEN", "tsconfig.json"]
}
Expected Behavior
Expected @acme/utils
to be included in @acme/api
To Reproduce
- Clone the reproduction repo: https://github.com/Blatty/turbo-vercel-repro
- Deploy to vercel, set the root directory to
apps/api
- Set the build command to
cd ../../ && npx turbo run build --filter=@acme/api
We also tried with --no-cache
& --force
, yarn install --cwd ../..
as the “install command” to trigger the postinstall
but without success 😞
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:13 (7 by maintainers)
@styfle I believe that this is the minimal reproduction: https://github.com/nathanhammond/workspace-symlink-issue
It fails differently, but I’m ~sure that it’s the same root cause. (Early vs. late failure.)
Vercel configuration:
cd ../.. && yarn build
cd ../.. && yarn
apps/api
This change was only applied to
vercel build
. Try withENABLE_VC_BUILD=1
environment variable and deploy again.