oven-sh / bun

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

[Crash]: Bun crashes when trying to install packages in subdirectories #11314

Closed uhidontkno closed 3 months ago

uhidontkno commented 3 months ago

How can we reproduce the crash?

  1. Setup Bun (eg. start a new React project)
  2. Go into sub folders (eg. project/nested/folder)
  3. Install a package (eg. bun i tailwindcss)

JavaScript/TypeScript code that reproduces the crash?

Not applicable

Relevant log output

[0.04ms] ".env"
bun add v1.1.9 (bb13798d)
============================================================
Bun v1.1.9 (bb13798d) Linux x64
Args: "bun", "i", "@catppuccin/tailwindcss"
Features: dotenv 
Elapsed: 4ms | User: 6ms | Sys: 3ms
RSS: 1.07GB | Peak: 24.47MB | Commit: 1.07GB | Faults: 0

panic(main thread): ENOENT parsing package.json
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:

 https://bun.report/1.1.9/li1bb13798AgIgh/h+Cw4126Civq73C2vyo4Csu4n4Cgltg0C+g//zCA0eNqTjjbIlY42Nsx19fN39QuRjjbIVShILCrOzEtXKEhMzk5MT9XLKs7PA0kAACt0DjI

Illegal instruction (core dumped)

Working directory: project/server/static fyi: package.json resides in the root directory.

Stack Trace (bun.report)

Bun v1.1.9 ([`bb13798`](<https://github.com/oven-sh/bun/tree/bb13798d9802d26770d8467a200022a2b91f7afd>)) on linux x86_64 [InstallCommand]

**panic**: ENOENT parsing package.json

- [`debug.zig:373`](<https://github.com/oven-sh/bun/blob/bb13798d9802d26770d8467a200022a2b91f7afd/src/deps/zig/lib/std/debug.zig#L373>): `debug.panicExtra__anon_318900`
- [`debug.zig:348`](<https://github.com/oven-sh/bun/blob/bb13798d9802d26770d8467a200022a2b91f7afd/src/deps/zig/lib/std/debug.zig#L348>): `debug.panic__anon_291546`
- [`output.zig:354`](<https://github.com/oven-sh/bun/blob/bb13798d9802d26770d8467a200022a2b91f7afd/src/output.zig#L354>): `src.output.panic__anon_68716`
- [`install.zig:8570`](<https://github.com/oven-sh/bun/blob/bb13798d9802d26770d8467a200022a2b91f7afd/src/install/install.zig#L8570>): `src.install.install.PackageManager.updatePackageJSONAndInstallWithManager__anon_68598`
- [`install.zig:8836`](<https://github.com/oven-sh/bun/blob/bb13798d9802d26770d8467a200022a2b91f7afd/src/install/install.zig#L8836>): `src.cli.install_command.InstallCommand.exec`
- [`cli.zig:1452`](<https://github.com/oven-sh/bun/blob/bb13798d9802d26770d8467a200022a2b91f7afd/src/cli.zig#L1452>): `src.cli.Cli.start`
- [`main.zig:50`](<https://github.com/oven-sh/bun/blob/bb13798d9802d26770d8467a200022a2b91f7afd/src/main.zig#L50>): `main`

<!-- from bun.report: meXYFYFj3gtwqk6dGtrh -->

Other information:

This was the project structure:

.
├── bot
│   ├── commands
│   │   └── ping.ts
│   ├── events
│   │   └── botReady.ts
│   └── index.ts
├── bun.lockb
├── components
│   └── logger.ts
├── index.ts
├── server
│   ├── config.ts
│   ├── index.ts
│   └── static -- directory that I was in when invoking the crash
│       ├── index.html
│       └── tailwind.config.js
├── seyfert.config.ts
└── tsconfig.json
Jarred-Sumner commented 3 months ago

This is fixed in the canary build of Bun, which will become Bun v1.1.10 in a few hours.

For now, please run bun upgrade --canary

uhidontkno commented 3 months ago

This is fixed in the canary build of Bun, which will become Bun v1.1.10 in a few hours.

For now, please run bun upgrade --canary

cool