bun icon indicating copy to clipboard operation
bun copied to clipboard

Optional dependencies cause package installations to fail

Open r614 opened this issue 1 year ago • 0 comments

What version of Bun is running?

1.1.30+7996d06b8

What platform is your computer?

Darwin 24.0.0 arm64 arm

What steps can reproduce the bug?

Installing pdf.js always pulls in the optional canvas dependency, ignoring bunfig settings. On a M1 Mac, the canvas installation fails, which also causes bun install to fail in the process.

Steps to Reproduce

Try installing the following package.json on a M1 mac without Cairo. The same behavior can also be reproduced where any library pulls in an optional dependency, which fails to install.

package.json

{
  "name": "test",
  "private": true,
  "version": "0.0.1",
  "main": "dist/index.js",
  "types": "dist/index.d.ts",
  "files": [
    "dist"
  ],
  "dependencies": {
        "pdf.js": "4.7.76"
  },
  "scripts": {
    "build": "bun run build.js"
  }
}

Run: bun install

What is the expected behavior?

Dependency Installation proceeds without installing the optional dependency, or the installation succeeds even if the optional depdency fails to install

What do you see instead?

Dependency Installation fails.

Additional information

Linked Issues:

  • https://github.com/oven-sh/bun/issues/7274

r614 avatar Oct 16 '24 19:10 r614