Skip to content

Generator still shows overall success banner after failed Shakapacker install with --ignore-warnings #2600

@ihabadham

Description

@ihabadham

Environment

  • Ruby version: 3.3.7
  • Rails version: 8.1.2
  • Shakapacker version: 9.4.0
  • React on Rails version: 16.x (master reproduced at 14afa475db74a381f2148b42f999e4fa7507b97b on March 14, 2026)

Expected behavior

When shakapacker:install fails and --ignore-warnings is set, the generator should not end with the overall 🎉 React on Rails Successfully Installed! banner or quick-start instructions that imply the app is ready to use.

At minimum, the final message should clearly indicate a partial/incomplete installation and avoid suggesting commands like ./bin/dev unless the required Shakapacker files were actually created.

Actual behavior

This specific false-success message from #2422 is fixed on current master — after shakapacker:install fails, the generator no longer prints ✅ Shakapacker installed successfully!.

However, the generator still ends with the overall success banner even though Shakapacker installation failed:

ERROR: 🚫 Failed to install Shakapacker automatically.
...
╔════════════════════════════════════════════════════════════════════════╗
║  🎉 React on Rails Successfully Installed!                             ║
╚════════════════════════════════════════════════════════════════════════╝
...
📦 Shakapacker setup may be incomplete

In the reproduced app, the install is visibly incomplete:

  • package.json is missing
  • bin/shakapacker is missing
  • bin/shakapacker-dev-server is missing

But the final message still says to run ./bin/dev and visit /hello_world.

In practice, ./bin/dev static then fails immediately with:

unknown command: bin/shakapacker --watch

Related issue

Suspected root cause

run_generators still calls add_post_install_message unconditionally once execution continues under --ignore-warnings, even if GeneratorMessages already contains a fatal Shakapacker install error.

Suggested fix

Suppress or replace the final helpful_message_after_installation success banner when Shakapacker installation failed.

Possible approaches:

  • Track a failure flag when install_shakapacker fails
  • Render a different final message such as "React on Rails installation incomplete"
  • Avoid advertising ./bin/dev / visit URL instructions unless the expected Shakapacker files actually exist

Reproduction script

#!/bin/bash
set -euo pipefail

APP_DIR="/tmp/test_edge_case_$$"
HELPER_DIR="/tmp/test_edge_case_tools_$$"
mkdir -p "$HELPER_DIR"

# Preserve Ruby/Bundler tooling even if your Ruby install lives in a path that
# gets filtered out below (for example via mise).
for exe in ruby bundle bundler gem rake rails; do
  target=$(command -v "$exe" || true)
  if [ -n "$target" ]; then
    ln -sf "$target" "$HELPER_DIR/$exe"
  fi
done

rails new "$APP_DIR" --minimal --skip-git --skip-bundle --skip-test --skip-javascript 2>/dev/null
cd "$APP_DIR"

cat >> Gemfile << GEMEOF
gem "shakapacker", "9.4.0"
gem "react_on_rails"
gem "foreman"
GEMEOF

bundle install --quiet

# Strip node from PATH so shakapacker:install fails, while keeping Ruby/Bundler available.
CLEAN_PATH=$(echo "$PATH" | tr ':' '\n' | grep -v -E '(node|nvm|fnm|volta|mise)' | tr '\n' ':')
PATH="$HELPER_DIR:$CLEAN_PATH" bundle exec rails generate react_on_rails:install --ignore-warnings 2>&1 | tee repro.log

# Look for:
# - "Failed to install Shakapacker automatically."
# - later, the final "React on Rails Successfully Installed!" banner
#
# Then verify the install is incomplete:
# - package.json missing
# - bin/shakapacker missing
# - bin/shakapacker-dev-server missing
# - ./bin/dev static fails with: "unknown command: bin/shakapacker --watch"

Impact

Low-to-medium — this requires both:

  1. --ignore-warnings
  2. a failed Shakapacker install

But when it happens, the final UX is still misleading because the app looks "installed" even though the normal dev workflow is broken.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions