-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
when creating a new rails 7.1 with bun, the JS side errors out on foreman (bin/dev) #49522
Comments
Hey, thanks for reporting the issue. So I ran your script It also generated a {
"name": "app",
"scripts": {
"build": "bun bun.config.js",
"build:css": "tailwindcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css --minify"
},
"dependencies": {
"@hotwired/stimulus": "^3.2.2",
"@hotwired/turbo-rails": "^7.3.0",
"autoprefixer": "latest",
"postcss": "latest",
"tailwindcss": "latest"
}
}
System configurationRails version: 7.1 Ruby version: 3.2.2 |
Can you share what's in your |
Hmm, I just ran that again:
I think this is what's going on: I have npm and bun installed, but not yarn:
It looks like we use yarn to add turbo, here:
Looking at package.json, it doesn't have the (yarn) added packages:
Here's the Procfile.dev:
Is there a way to use only bun in rails new if bun is enabled? e.g. if bun, then do "bun a @hotwired/turbo-rails" instead of yarn |
Okay, I went down a rabbit hole here and it looks like if (js_entrypoint_path = Rails.root.join("app/javascript/application.js")).exist?
say "Import Turbo"
append_to_file "app/javascript/application.js", %(import "@hotwired/turbo-rails"\n)
else
say "You must import @hotwired/turbo-rails in your JavaScript entrypoint file", :red
end
say "Install Turbo"
run "bun add @hotwired/turbo-rails" Rails is still recognizing you chose bun here:
After I temporarily uninstalled yarn I ran into the same issues as you. I think this is a bug, but with You can see here we only get two of the install files and not the bun one: turbo-rails-1.4.0/lib/install via 💎 v3.2.2
❯ ls
turbo_needs_redis.rb turbo_with_importmap.rb turbo_with_node.rb
(base) @afcapel @kevinmcconnell any idea why the gem is installing without turbo_with_bun.rb? |
@paulreece this is happening because someone on the Hotwire team still needs to cut a release of hotwire-rails and stimulus-rails that contains the bun code. |
@terracatta Thanks for clarifying! |
@whyczz See the release notes here - It was released in March and @terracatta added the |
Makes sense, I'll close this. |
@whyczz Let's actually leave this open so that the maintainers are aware, and so that other folks who are having the issue won't raise duplicates. |
I think this issue has cropped up a couple of times (#48076), a requirement of css bundling is that you have yarn installed https://github.com/rails/cssbundling-rails#installation IIRC you could prob do everything with npm these days? Potentially that yarn dependency could get removed from cssbundling? 🤔 |
Yes and to be clear the main issue here is if the user wants to use The issue will effectively be solved as soon as the new |
Closing as suggested by @zzak. Current workaround noted above. |
I've just published new versions of |
So are node and yarn still required for cssbundling-rails? Its README still states:
|
That's exciting!! |
@sedubois Currently you'll still need yarn. I tested this a few times locally and it tries to use yarn every time: Add build:css script
Add build:css script
run npm pkg set scripts.build:css="tailwindcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css --minify" from "."
run yarn build:css from "."
Usage Error: The nearest package directory (/Users/ruby_test/test_seven) doesn't seem to be part of the project declared in /Users/. I think it is possibly because the conditional here is explicitly checking for the def using_bun?
File.exist?('bun.lockb') || (tool_exists?('bun') && !File.exist?('yarn.lock'))
end ❯ rails c
irb(main):001> File.exist?('bun.lockb')
=> false ❯ ls
Dockerfile README.md bun.config.js lib storage vendor
Gemfile Rakefile config log tailwind.config.js
Gemfile.lock app config.ru package.json test
Procfile.dev bin db public tmp |
I had a similar problem but with
Was giving me errors:
In my case was a weird issue with the installation of I found a file in the root of one of my folders called: |
After creating a new rails 7.1 app with bun enabled, the generated package.json doesn't have
@hotwired/turbo-rails
added, so the Procfile.dev fails on the js process/container.Steps to reproduce
Expected behavior
I should get the Procfile.dev to be up and running.
Actual behavior
The JS process fails:
Fix
Add the two hotwired packages:
And here's the updated package.json:
System configuration
Rails version: 7.1
Ruby version: 3.2.2
The text was updated successfully, but these errors were encountered: