-
-
Notifications
You must be signed in to change notification settings - Fork 638
Description
A bug is a crash or incorrect behavior. If you have a debugging or troubleshooting question, please open a discussion.
Environment
- Ruby version: 3.3.7
- Rails version: 8.0.4
- Shakapacker/Webpacker version: Not required for reproduction (bug occurs during version check before Shakapacker setup)
- 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:doctorYou'll see the false version mismatch warning despite both packages being at the same version.