oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.26k stars 2.69k forks source link

`error: CouldntReadCurrentDirectory` #5182

Open robobun opened 1 year ago

robobun commented 1 year ago

I move the project to another folder then bun run dev wont run.

error: CouldntReadCurrentDirectory

----- bun meta ----- Bun v1.0.0 (822a00c4) macOS Silicon 22.6.0 AutoCommand: Elapsed: 16ms | User: 5ms | Sys: 10ms RSS: 5.39MB | Peak: 5.39MB | Commit: 33.55MB | Faults: 184 ----- bun meta -----

0 0x104656624 WTFGetBacktrace

Search GitHub issues https://bun.sh/issues or ask for <#1006402902513946735> in https://bun.sh/discord

Error loading directory: "FileNotFound"

error: FileNotFound Bun could not find a file, and the code that produces this error is missing a better error.

----- bun meta ----- Bun v1.0.0 (822a00c4) macOS Silicon 22.6.0 RunCommand: Elapsed: 14ms | User: 5ms | Sys: 10ms RSS: 5.44MB | Peak: 5.44MB | Commit: 33.55MB | Faults: 189 ----- bun meta -----

Originally reported on Discord: Error loading directory: "FileNotFound"

itsalimanuel commented 10 months ago

Same issue here with bun install

----- bun meta -----
Bun v1.0.11 (f7f6233e) macOS Silicon 23.0.0
InstallCommand: 
Elapsed: 156ms | User: 25ms | Sys: 40ms
RSS: 23.10MB | Peak: 23.10MB | Commit: 7.36MB | Faults: 154
----- bun meta -----
rayansindi1 commented 9 months ago

Had the same issue here and i was able to solve it just by restarting my computer 🥶

itsalimanuel commented 9 months ago

I don't think that's the solution. 🤔

CodeIter commented 4 months ago

I have this issue(CouldntReadCurrentDirectory) when running file without Javascript /Typescript file extension or from standard input .

It seems that bun rely on a correct Javascript and Typescript file extension.

Running this on Termux, so it might be a limitation of glibc-runner #8685 .

I made a shell script termux-pacman-glibc-setup.sh to setup glibc-runner with pacman on Termux and install Deno.JS and Bun.JS as a demo.

From standard Input:

grun bun repl < <(echo "console.log('Hello world')")

Output:

error loading current directory
error: An internal error occurred (CouldntReadCurrentDirectory)

From file without Javascript extension:

grun bun run <(echo "console.log('Hello world')")

Output:

error loading current directory
error: An internal error occurred (CouldntReadCurrentDirectory)

From file with Javascript extension:

file=$(mktemp -p ~/.cache --suffix .js hello-XXX )
echo "console.log('Hello world')" > $file
grun bun run $file

Output:

Hello world
Minecatr commented 3 months ago

This was caused for me due to me using bun on snap and having it installed in the normal way, this could possibly fix it.

Jarred-Sumner commented 3 months ago

Ah yeah, snap has strange permissions which we do not support