Skip to content

Doctor command shows false version mismatch warning for beta/prerelease versions #2063

@ihabadham

Description

@ihabadham

A bug is a crash or incorrect behavior. If you have a debugging or troubleshooting question, please open a discussion.

Environment

  1. Ruby version: 3.3.7
  2. Rails version: 8.0.4
  3. Shakapacker/Webpacker version: Not required for reproduction (bug occurs during version check before Shakapacker setup)
  4. React on Rails version: 16.2.0.beta.10

Expected behavior

When running rake react_on_rails:doctor with matching gem and NPM package versions (both at 16.2.0.beta.10), the doctor should report that versions match.

Actual behavior

Doctor incorrectly shows a version mismatch warning even when versions are identical:

⚠️  Version mismatch detected:
• Gem version: 16.2.0.beta.10
• NPM version: 16.2.0-beta.10

Root cause: NPM uses -beta format while Ruby gems use .beta format. The version comparison code in lib/react_on_rails/system_checker.rb:217-220 removes all non-numeric/non-dot characters from the NPM version (turning 16.2.0-beta.10 into 16.2.0.10) but compares it against the uncleaned gem version (16.2.0.beta.10), causing them to never match.

Impact: All beta/alpha/rc/pre versions trigger false warnings. Only stable versions work correctly.

Small, reproducible repo

rails new test_app --skip-javascript && cd test_app
bundle add react_on_rails --version "16.2.0.beta.10" --strict
yarn add [email protected]
bundle exec rake react_on_rails:doctor

You'll see the false version mismatch warning despite both packages being at the same version.

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