Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bun install fails without .gitattributes file in project root #175

Open
Petercopter opened this issue Oct 8, 2023 · 3 comments · May be fixed by #193
Open

bun install fails without .gitattributes file in project root #175

Petercopter opened this issue Oct 8, 2023 · 3 comments · May be fixed by #193

Comments

@Petercopter
Copy link

I was trying to replace esbuild with bun by running the installer:

./bin/rails javascript:install:bun

but I got this error:

Add ability to diff lockb to .gitattributes
rails aborted!
Thor::Error: Could not find "/Users/peter/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/jsbundling-rails-1.2.1/lib/install/bun/.gitattributes" in any of your source paths. Your current source paths are: 
/Users/peter/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.8/lib/rails/generators/rails/app/templates

So I tested in a different project, and that one worked because it had a .gitattributes file in the root.

It looks like adding a .gitattributes file is a new-ish thing in Rails, that's why the first project didn't have one, it's about 3 years old. https://github.com/platformsh-templates/rails/commits/master/.gitattributes

So it seems like the jsbundling-rails installer just needs to check and see if that file already exists or not.

@sronsiek
Copy link

sronsiek commented Jan 9, 2024

After creating an empty .gitattributes in the project root dir, the bun install command works and outputs:

Run 'git config diff.lockb.textconv bun && git config diff.lockb.binary true' to enable pretty diffs for Bun's .lockb file

Why is it assumed git is in use? I my case it is not, and git is not installed!

@dhh
Copy link
Member

dhh commented Jan 21, 2024

Feel free to open a PR fixing this.

@pokonski
Copy link

pokonski commented May 9, 2024

Actually the problem lies elsewhere. When the gem is built, the .gitattributes file is not properly bundled with it which is what the error is implying.

PR with a fix here: #193

@pokonski pokonski linked a pull request May 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants