bun icon indicating copy to clipboard operation
bun copied to clipboard

bun.lockb prevents auto imports

Open yus-ham opened this issue 1 year ago • 3 comments

What version of Bun is running?

1.1.8

What platform is your computer?

Linux 6.8.0-31-generic x86_64 x86_64

What steps can reproduce the bug?

image

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

yus-ham avatar May 13 '24 13:05 yus-ham

The intention is that if there is a bun.lockb / package.json, Bun will use that instead of auto-imports.

Electroid avatar May 13 '24 17:05 Electroid

Version resolution To determine which version to install, Bun follows the following algorithm:

  1. Check for a bun.lockb file in the project root. If it exists, use the version specified in the lockfile.
  2. Otherwise, scan up the tree for a package.json that includes "foo" as a dependency. If found, use the specified semver version or version range.
  3. Otherwise, use latest.

Maybe I misunderstood the docs explanation that auto import can coexist with bun.lockb or package.json and optionally uses them

yus-ham avatar May 13 '24 17:05 yus-ham

I too am confused -- would think auto-import shoudl work if those files exist and if they do, use the versions in those files

bdombro avatar May 23 '24 00:05 bdombro

Do you by any chance have a node_modules in this dir or any parents?

edit: nvm, i see you delete bun.lockb and then it works

RiskyMH avatar Jan 31 '25 03:01 RiskyMH