Open mnpenner opened 1 year ago
Any progress on this at all? Amazing feature, but haven't seen it working even in the latest.
This also doesn't work if node_modules is present in a parent directory 😞
Updating this, I have found that Bun does not fallback or install on running a script (even with --install force
), even when there is no node_modules directory present. This is still true with or without a package.json. I am running on Windows 11.
@PhilBladen
even when there is no node_modules directory present
This part works for me in 1.0.17, but force
does not seem to get bun to ignore any parent node_modules
directories.
OK, I bisected a little. --install=force
stopped working in v1.0.0
. v0.8.1
respects the cli option.
@andsens thanks for your prompt. I have done some more experimenting and my results match yours. It turns out in my previous message that there was a sneaky node_modules
hiding several folders up.
In summary:
node_modules
present in the current or any parent directory--install=force
does not appear to do anything in Bun v1.1.17 and 1.1.18 (won't ignore parent node_modules
)I have, however, discovered another issue in that auto-installed modules aren't loadable:
I created the following test.js file at the top of my filesystem (no node_modules
present):
import * as cowsay from "cowsay";
console.log(cowsay.say({text: "hi"}));
I ran with bun test.js
and I get the following error error: Unexpected while resolving package "cowsay" from "D:\test.js"
If I run bun i cowsay
first, it works fine.
Using Bun v1.1.18 and Windows 11.
What version of Bun is running?
1.0.26+c75e768a6
What platform is your computer?
Linux 4.4.0-19041-Microsoft x86_64 x86_64
What steps can reproduce the bug?
Paste this script:
Save (ctrl+x).
Try to run it:
Get error:
Note the
mkdir node_modules
step is key. It won't fallback when it sees that dir even though the docs suggest that it should.bun --install=force cow.ts
doesn't work either.What is the expected behavior?
Should auto-install
cowsay
because it's clearly missing from thenode_modules
dir.What do you see instead?
Additional information
I'm using WSL if it matters.