[turborepo] `pnpm run benchmark` fails silently if user has a `package.json` or `yarn.lock` higher up in their dir tree
What version of Turborepo are you using?
Latest
What package manager are you using / does the bug impact?
pnpm
What operating system are you using?
Mac
Describe the Bug
https://github.com/vercel/turbo/blob/84771fbc3bc3f9795e7c2ab54b2491af82fc1793/benchmark/src/index.ts#L12
https://github.com/vercel/turbo/blob/84771fbc3bc3f9795e7c2ab54b2491af82fc1793/benchmark/src/index.ts#L61
Usage Error: The nearest package directory (/Users/Vaughan/dev/fork/+turbo/turbo/benchmark/large-monorepo) doesn't seem to be part of the project declared in /Users/Vaughan.
- If /Users/Vaughan isn't intended to be a project, remove any yarn.lock and/or package.json file there.
- If /Users/Vaughan is intended to be a project, it might be that you forgot to list dev/fork/+turbo/turbo/benchmark/large-monorepo in its workspace configuration.
- Finally, if /Users/Vaughan is fine and you intend dev/fork/+turbo/turbo/benchmark/large-monorepo to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.
$ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]
error
Error: Command failed: yarn install
at __node_internal_genericNodeError (node:internal/errors:863:15)
at checkExecSyncError (node:child_process:871:11)
at Object.execSync (node:child_process:943:15)
at setup (/Users/Vaughan/dev/fork/+turbo/turbo/benchmark/src/index.ts:64:8)
at Object.<anonymous> (/Users/Vaughan/dev/fork/+turbo/turbo/benchmark/src/index.ts:266:1)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._compile (/Users/Vaughan/dev/fork/+turbo/turbo/node_modules/.pnpm/[email protected][email protected]/node_modules/esbuild-register/dist/node.js:2258:26)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Object.newLoader [as .ts] (/Users/Vaughan/dev/fork/+turbo/turbo/node_modules/.pnpm/[email protected][email protected]/node_modules/esbuild-register/dist/node.js:2262:9)
at Module.load (node:internal/modules/cjs/loader:1037:32) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 8788,
stdout: null,
stderr: null
}
This error is silenced by stdio: silent which is annoying.
The workaround is to
Expected Behavior
The error shouldn't be silenced so the user can resolve it by following the instructions.
To Reproduce
Create a yarn.lock and package.json in your ~/ and run pnpm run benchmark.
Reproduction Repo
No response
Related
Here is the yarn issue.
- https://github.com/yarnpkg/berry/issues/2212
- https://github.com/yarnpkg/berry/issues/1050
Seems like silly yarn behaviour. Not resolved.
I'm not sure how you guys avoid this issue.
Workaround
Adding:
cp.execSync("touch yarn.lock", {cwd: REPO_PATH})
From https://github.com/yarnpkg/berry/issues/1050#issuecomment-596659082
Also, while fixing this, you should add a flag to unsilence the stdio...it takes a long time and there is not status updates...