bun icon indicating copy to clipboard operation
bun copied to clipboard

windows: (bun: v1.1.1) bun create & bunx using npm to install dependencies on windows.

Open vgseven opened this issue 10 months ago • 3 comments

What version of Bun is running?

1.1.1+ca1dbb4eb

What platform is your computer?

Microsoft Windows NT 10.0.22621.0 x64 (Windows 11)

What steps can reproduce the bug?

creating an next.js app using bun (1.1.1) on windows with bun create next-app@latest or bunx create-next-app@latest uses npm to install dependencies which consumes too much time for installations.

following screenshots shows the process while installing next using bun:

bun-npm bun-i

What is the expected behavior?

I have tried bun last month when canary version of bun (1.0.35 - 36) rolling, the app created using bun create next-app@latest uses bun not npm to install dependencies and init next app due to un-function state of bunx.

bun (1.0.35) is fast enough to install and init next app using bun, but currently after bundows release to process of installing any app takes too much time and I think it's because of use of npm behind the scene.

bun needs to use bun again for all functions of bun...

What do you see instead?

As shown in screenshot bun is using npm instead of bun for installation process which consumes too much time..

Additional information

bunx create-next-app@latest uses bun to install next app which takes almost 94.44 sec.

bun-i-linux

vgseven avatar Apr 05 '24 13:04 vgseven

You can force it with --use-bun while waiting for a fix

cosigyn avatar Apr 05 '24 22:04 cosigyn

It looks like create-next-app is using process.env.npm_config_user_agent to determine whether to use Bun or not:

https://github.com/vercel/next.js/blob/f9ad49fc6f57f3bcf4f508b59deab695f06c74b1/packages/create-next-app/helpers/get-pkg-manager.ts#L4

It's possible we're not setting this properly on Windows.

Electroid avatar Apr 08 '24 21:04 Electroid

npm is the default pkg manager if none of any (yarn, pnpm, bun) detected. create-next-app works with bun if flagged with --bun as @cosigyn mentioned above.

needs to be fixed, want to use it for prod application (vgseven.com) on windows...

vgseven avatar Apr 10 '24 02:04 vgseven

bun uses node internally also and with installation still on windows. Screenshot 2024-05-01 073635 Screenshot 2024-05-01 073806

If it's flagged with --bun it install with bun.

And mainly bun doesn't support access or have added bun for installation with create I guess. I tried accessing bun:sqlite but vscode says there's nothing named bun in node_modules. When I add @types/bun as dev-dependencies then it starts supporting bun.

I think if we're using bun why node is still accessible in that project.

note: using bun - 1.1.6

vgseven avatar May 01 '24 02:05 vgseven