bun
bun copied to clipboard
bun --filter gives (error: ENOENT)
What version of Bun is running?
1.1.10-canary.1+6566b8a6d
What platform is your computer?
Darwin 23.5.0 arm64 arm
What steps can reproduce the bug?
Add workspaces to a package.json and run bun --filter '*' dev or a specific package in the filter
What is the expected behavior?
that the dev script would be executed in all packages.
What do you see instead?
➜ bun --filter 'isomorphic' run dev error: ENOENT
Additional information
No response
I can't repro this anymore
Did you upgrade since this happened, we are now getting this as well? On latest version (1.1.12)
@dbrxnds do you have a folder named "dev" by chance?
@Jarred-Sumner We do not. And I get it with bun --filter orderpicker typecheck (orderpicker is our main application workspace) as well
@dbrxnds if you're on Linux by chance, do you think you could paste the output of
sudo perf trace $(which bun) --filter orderpicker typecheck
That will tell us what specific path Bun is searching through and seeing ENOENT. Then that will get us closer to where the bug is ocurring.
@Jarred-Sumner, is this what you are expecting? https://gist.github.com/dbrxnds/41bd83a5a66bb70cb86cf2e05653d296
@dbrxnds yes but sadly not as helpful as I thought it'd be
@Jarred-Sumner Unfortunate, let me know if I can do / share anything else
I believe I hit this error in the first place by providing some syntax not expected by bun (initial slash)
"workspaces": [
"/packages/*"
],
If I use the syntax below (provided in bun docs), things work as expected
"workspaces": [
"packages/*"
],
@dbrxnds , how do you define your workspaces in package.json?
Interesting @birkskyum, here's ours:
"workspaces": [
"apps/*",
"packages/*",
"serverless",
"serverless/layers/*",
"serverless/services/*",
"scripts"
],
Hi @birkskyum, your comment made me check if I could get it working by removing/changing workspaces as well.
In our case it seems to happen due to a workspace being nested. @Jarred-Sumner
Doesn't work:
"workspaces": [
"apps/*",
"packages/*",
"serverless/services/*",
"scripts"
],
Works:
"workspaces": [
"apps/*",
"packages/*",
"scripts"
],
I get same error when running bun --filter inside bun docker image CMD e.g:
FROM oven/bun:slim
WORKDIR /app
COPY . .
RUN bun install --frozen-lockfile --production
CMD ["bun", "--filter", "./app/web", "start" ]
Error running image: error: ENOENT
package.json
{
"name": "app",
"private": true,
"scripts": {},
"workspaces": [
"packages/*",
"apps/*"
],
"dependencies": {},
"devDependencies": {
"@biomejs/biome": "1.9.4"
}
}
I can confirm this also started happening randomly in my docker build. Same type of command, also with workspaces.
I also tried checking out the last successful commit of my code that build, together with the sha of the last bun docker image that built successfully, but that does not work either. Not quite sure what's going on here.
Update
I just worked around the issue by using --cwd instead and running the scripts that --filter would hit, and it works just fine. So there is definitely something strange with --filter that affects certain environments.
In my case I was seeing this when adding a new workspace with a directory name that was camel case, when I renamed the new module to be all lower case the issue went away
I was having this exact issue then a team member figured it out.
EVERY package must have the script.
For instance: bun --filter "./packages/*" lint
required that all the packages located in './packages/*' have a script called lint, in order for the filter to pass successfully.
So my script is noo preset in every workspace. The interresting things is that it works fine on Mac arm64, but it fails on linux/amd64
Same here any usage of --filter works fine locally (MacOS Sonoma aarch64) but ENOENT on gh actions (Ubuntu LTS)
"workspaces": [
"packages/**",
"apps/**"
]
I did find a vague interplay between --omit=dev, which causes (recursively) a peer dependency not to be installed. Which solves the issue in some of my workspaces, but not all