vercel / turborepo

Build system optimized for JavaScript and TypeScript, written in Rust
https://turbo.build/repo/docs
MIT License
26.31k stars 1.82k forks source link

[turborepo] prune fails when using local dependencies #5079

Open yarinsa opened 1 year ago

yarinsa commented 1 year ago

What version of Turborepo are you using?

1.9.8

What package manager are you using / does the bug impact?

Yarn v2/v3 (node_modules linker only)

What operating system are you using?

Mac

Describe the Bug

I am using a local dependency (that can't be uploaded to private registry unfortunately).

When running 'turbo prune --scope="my-pkg" --docker The outcome is that the final output of docker prune doesn't include the lock file

I am getting the following RUST error:

Generating pruned monorepo for @linx/console in <path>/out
 - Added @linx/api-client
 - Added @linx/console
 - Added @linx/eslint-config
 - Added @linx/ioredis-authjs-adapter
 - Added @linx/tsconfig
 - Added @linx/ui
thread '<unnamed>' panicked at 'No locator found for <package_name>@file:./assets/<package_name>.tgz', crates/turborepo-lockfiles/src/berry/mod.rs:265:44
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <turborepo_lockfiles::berry::BerryLockfile>::subgraph
   3: turborepo_lockfiles::berry::berry_subgraph
   4: _subgraph
   5: __cgo_49699e29077a_Cfunc_subgraph
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
fatal runtime error: failed to initiate panic, error 5
SIGABRT: abort
PC=0x184a9b224 m=12 sigcode=0
signal arrived during cgo execution

goroutine 6 [syscall]:
runtime.cgocall(0x102ac9e40, 0x1400034d568)
    runtime/cgocall.go:157 +0x54 fp=0x1400034d520 sp=0x1400034d4e0 pc=0x1025014f4
github.com/vercel/turbo/cli/internal/ffi._Cfunc_subgraph({0xda8f1, 0x160030000})
    _cgo_gotypes.go:165 +0x40 fp=0x1400034d560 sp=0x1400034d520 pc=0x102984950
github.com/vercel/turbo/cli/internal/ffi.Subgraph({0x102ea68f7, 0x5}, {0x14000400000, 0xc7eeb, 0xc7eec}, {0x14000116480, 0x6, 0x6}, {0x140007b0000, 0xad6, ...}, ...)
    github.com/vercel/turbo/cli/internal/ffi/ffi.go:238 +0x1e4 fp=0x1400034d670 sp=0x1400034d560 pc=0x102985d24
github.com/vercel/turbo/cli/internal/lockfile.(*BerryLockfile).Subgraph(0x14000032760, {0x140000a6300, 0x6, 0x140000324a0?}, {0x140007b0000, 0xad6, 0xe00})
    github.com/vercel/turbo/cli/internal/lockfile/berry_lockfile.go:40 +0x94 fp=0x1400034d700 sp=0x1400034d670 pc=0x102994a44
github.com/vercel/turbo/cli/internal/prune.(*prune).prune(0x1400034df50, 0x140002e0cf0, {0x140002b9f92, 0x5})
    github.com/vercel/turbo/cli/internal/prune/prune.go:181 +0xce4 fp=0x1400034def0 sp=0x1400034d700 pc=0x1029f30e4
github.com/vercel/turbo/cli/internal/prune.ExecutePrune(0x0?, 0x14000283d40)
    github.com/vercel/turbo/cli/internal/prune/prune.go:45 +0xe8 fp=0x1400034df60 sp=0x1400034def0 pc=0x1029f2138
github.com/vercel/turbo/cli/internal/cmd.RunWithExecutionState.func1()
    github.com/vercel/turbo/cli/internal/cmd/root.go:67 +0x108 fp=0x1400034dfd0 sp=0x1400034df60 pc=0x102ac92e8
runtime.goexit()
    runtime/asm_arm64.s:1270 +0x4 fp=0x1400034dfd0 sp=0x1400034dfd0 pc=0x1025654f4
created by github.com/vercel/turbo/cli/internal/cmd.RunWithExecutionState
    github.com/vercel/turbo/cli/internal/cmd/root.go:64 +0x2c4

goroutine 1 [select]:
github.com/vercel/turbo/cli/internal/cmd.RunWithExecutionState(0x14000283d40, {0x102ea6401, 0x5})
    github.com/vercel/turbo/cli/internal/cmd/root.go:79 +0x2fc
main.main()
    github.com/vercel/turbo/cli/cmd/turbo/main.go:30 +0x1d8

goroutine 20 [syscall]:

Expected Behavior

The process will exit with code 0

To Reproduce

Run the following codesandbox And run in the terminal yarn turbo prune --scope=docs --docker

Reproduction Repo

No response

danielpza commented 1 year ago

I'm also having this issue after updating to the latest version

yarn 3.5.0
yarn nodeLinker: node-modules
turbo 1.9.9

First version we were able to reproduce it was turbo@1.9.7, but we were blocked by another issue so it might have been introduced earlier.

javiergonzalezGenially commented 1 year ago

I get the same but while using patches (e..g "froala-editor": "patch:froala-editor@4.0.14#../../patches/froala-editor+4.0.14.patch",)

cimboe commented 1 year ago

We get the same error with resolutions in the workspace root using the latest canary (or any other version for that matter).

danielpza commented 1 year ago

Still seeing this issue with the latest version 1.10.7, this is a blocker to update, we are kind of stuck in an old version

vogtb commented 1 year ago

We are experiencing this issue on 1.10.13

javiergonzalezGenially commented 9 months ago

Still happening in turbo 1.12.2 and yarn 3.7.0

11.13 Turbo error: unable to find any locator for froala-editor@patch:froala-editor@4.0.14#../../patches/froala-editor+4.0.14.patch

package.json:

    "froala-editor": "patch:froala-editor@4.0.14#../../patches/froala-editor+4.0.14.patch",

yarn.lock:

"froala-editor@patch:froala-editor@4.0.14#../../patches/froala-editor+4.0.14.patch::locator=%40apps%2Feditor%40workspace%3Aapps%2Feditor":
  version: 4.0.14
  resolution: "froala-editor@patch:froala-editor@npm%3A4.0.14#../../patches/froala-editor+4.0.14.patch::version=4.0.14&hash=431c3b&locator=%40apps%2Feditor%40workspace%3Aapps%2Feditor"
  checksum: 85613e8dae9206989f29b9f8b88874f51be990c4c8eb6a06743bdc83fe87230f366fd416dd6676c23bb4924c7ffeb65c4d6739c2eae718100967e786114447b5
  languageName: node
  linkType: hard

maybe this could be fixed for yarn v3 like it got fixed for v4 by chris-olszewski in this PR? https://github.com/vercel/turbo/pull/6974

anglinb commented 2 weeks ago

Looks like this is still an issue with 2.1.3 and yarn 4.