Error message

Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in menu_set_active_trail() (line 2404 of /usr/share/drupal7/includes/menu.inc).

bun (bun.sh) crash with error: IsDir. Reason and solution.

Tags: 

As bun sounds promising, I've been adapting it in my daily life for a better/alternative solution to npm.

The Pain

The pain But today I got error: IsDir in my new helloworld project for learning React.

$ bun install

error: IsDir

----- bun meta -----
Bun v0.5.9 (f3ab445c) Linux x64 #77-Ubuntu SMP Tue Mar 21 14:02:37 UTC 2023
InstallCommand: 
Elapsed: 1ms | User: 0ms | Sys: 4ms
RSS: 34.61MB | Peak: 10.31MB | Commit: 34.61MB | Faults: 0
----- bun meta -----

0   0x555b15fa6a2b

Crash report saved to:
  ~/.bun/.bun-crash/v0.5.9-1682727515780.crash

Search GitHub issues https://bun.sh/issues or ask for #help in https://bun.sh/discord

Google search found nothing related, but a closed issue did help. - error: IsDir when running bun install #168 https://github.com/oven-sh/bun/issues/168

The Cause

so on install, bun looks for a plaintext .env file - https://github.com/oven-sh/bun/blob/c3bf97002d6f0b117060dabf2aa281eedd85b7fd/src/env_loader.zig and then tries to parse it. If .env is a folder, it will fall over.

https://github.com/oven-sh/bun/issues/168#issuecomment-1186135733

The Fix

If you have a .env/ in your project root folder, rename or remove it. Bun will act normal now.

Add new comment