oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.01k stars 2.66k forks source link

bun install: error: FileNotFound #1815

Closed rtsao closed 1 year ago

rtsao commented 1 year ago

What version of Bun is running?

0.5.0

What platform is your computer?

Darwin 22.2.0 arm64 arm

What steps can reproduce the bug?

Run bun install. This is happening on a large Yarn berry monorepo. No glob workspaces are used.

What is the expected behavior?

What do you see instead?

❯ bun install --verbose
bun install v0.5.0 (aacaa9b8)

error: FileNotFound
bun could not find a file, and the code that produces this error is missing a better error.

----- bun meta -----
Bun v0.5.0 (aacaa9b8) macOS Silicon 22.2.0
InstallCommand:
Elapsed: 4ms | User: 4ms | Sys: 5ms
RSS: 13.93MB | Peak: 13.93MB | Commit: 69.22MB | Faults: 12
----- bun meta -----

Additional information

This monorepo has a single top-level "workspaces" field and zero nested workspaces.

FWIW, the monorepo does Yarn's patch: protocol, but only within the top-level "resolutions" field, which my understanding is not yet supported by Bun. That said, I figure this would merely be ignored.

Jarred-Sumner commented 1 year ago

If you could somehow DM me the repo with just the package.json files but the same directory tree, that would probably be enough for me to debug

My guess is that the folders listed in workspaces aren't an exact path from the root package.json

satvik007 commented 1 year ago

Seeing the issue here as well

https://github.com/algolia/instantsearch

bun install v0.5.0 (2db04ef9)

error: FileNotFound
bun could not find a file, and the code that produces this error is missing a better error.

----- bun meta -----
Bun v0.5.0 (2db04ef9) Linux x64 #64~20.04.1-Ubuntu SMP Fri Jan 6 16:42:31 UTC 2023
InstallCommand: 
Elapsed: 3ms | User: 0ms | Sys: 4ms
RSS: 69.21MB | Peak: 17.61MB | Commit: 69.21MB | Faults: 0
----- bun meta -----
alexlamsl commented 1 year ago

It uses glob pattern for workspaces, which is not supported yet:

https://github.com/algolia/instantsearch/blob/772c918f47aec183af3f1aa78c65505f70dd0088/package.json#L7-L11

"workspaces": [
  "examples/*/*",
  "packages/*",
  "tests/*",
  "scripts/*",
ancientstraits commented 1 year ago

Good to know. Where is the bun code that reads the package.json? I am interested in adding glob support.

alexlamsl commented 1 year ago

Around here: https://github.com/oven-sh/bun/blob/ac0dab3679ab610f247bddc9c34f6d4692afc9c4/src/install/lockfile.zig#L2520-L2945

rtsao commented 1 year ago

This no longer reproduces with the latest canary: v0.5.0 (9dfbf573)

It now segfaults, but I think it's a different issue