Skip to content

Commit c261b81

Browse files
justin808claude
andcommitted
Fix critical regression - Shakapacker installation when not already installed
URGENT FIX: Generator was failing when Shakapacker not already installed because it tried to run './bin/rails shakapacker:install' before bundle install made the command available. Changes: - Run 'bundle install' first to make shakapacker gem available - Use 'bundle exec rails shakapacker:install' instead of './bin/rails' - Update error message with correct troubleshooting steps 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 7f7d497 commit c261b81

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Changes since the last non-beta release.
3636
- Removed files: `rakelib/webpacker_examples.rake`, `lib/generators/react_on_rails/adapt_for_older_shakapacker_generator.rb`
3737
- All webpacker compatibility code and tests have been removed
3838
- **CI/Development runtime requirements updated**:
39+
- *Note, this is just what CI tests*. You can use older versions of Ruby and Node.js, but you may run into issues.*
3940
- Minimum Ruby version: 3.2 (was 3.0)
4041
- Maximum Ruby version: 3.4 (was 3.3)
4142
- Minimum Node.js version: 20 (was 16)

lib/generators/react_on_rails/install_generator.rb

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,17 @@ def ensure_shakapacker_in_gemfile
208208

209209
def install_shakapacker
210210
puts Rainbow("⚙️ Installing Shakapacker (required for webpack integration)...").yellow
211-
success = system("./bin/rails shakapacker:install")
211+
212+
# First run bundle install to make shakapacker available
213+
puts Rainbow("📦 Running bundle install...").yellow
214+
bundle_success = system("bundle install")
215+
unless bundle_success
216+
handle_shakapacker_install_error
217+
return
218+
end
219+
220+
# Then run the shakapacker installer
221+
success = system("bundle exec rails shakapacker:install")
212222
return if success
213223

214224
handle_shakapacker_install_error
@@ -254,9 +264,10 @@ def handle_shakapacker_install_error
254264
255265
Troubleshooting steps:
256266
1. Ensure Node.js is installed: node --version
257-
2. Try manually: ./bin/rails shakapacker:install
258-
3. Check for error output above
259-
4. Re-run: rails generate react_on_rails:install
267+
2. Run: bundle install
268+
3. Try manually: bundle exec rails shakapacker:install
269+
4. Check for error output above
270+
5. Re-run: rails generate react_on_rails:install
260271
261272
Need help? Visit: https://github.com/shakacode/shakapacker/blob/main/docs/installation.md
262273
MSG

react_on_rails.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
3131
s.add_dependency "execjs", "~> 2.5"
3232
s.add_dependency "rails", ">= 5.2"
3333
s.add_dependency "rainbow", "~> 3.0"
34-
s.add_dependency "shakapacker", "~> 8.2"
34+
s.add_dependency "shakapacker", "~> 8.0"
3535

3636
s.add_development_dependency "gem-release"
3737
s.post_install_message = '

0 commit comments

Comments
 (0)