使用country_select gem时出现i18n_data-0.10.0未找到错误求助
Hey Dylan, let's work through this issue together. Even though your bundle install output clearly shows i18n_data 0.10.0 is installed, your server is still throwing a missing gem error—this usually boils down to a mismatch between the gem environment your server is using and the one Bundler set up. Here are the steps to fix it:
Step 1: Always Start Your Server with bundle exec
When you restart your Rails server, make sure you're using Bundler to load the exact gems specified in your Gemfile.lock. Instead of just running rails s, use:
bundle exec rails s
This ensures your server uses the bundled version of i18n_data instead of any global gems that might be missing it.
Step 2: Clear Bundler's Cache and Reinstall Dependencies
Sometimes cached gem files can get corrupted or out of sync. Let's clean them up and start fresh:
# Force clean all unused gems bundle clean --force # Reinstall all gems from your Gemfile.lock bundle install
Step 3: Restart Spring (If You're Using It)
Spring keeps your Rails app running in the background for faster development, but it can cache outdated gem information. Stop it and let it restart with the fresh gem set:
spring stop
Then run bundle exec rails s again—Spring will restart automatically with the correct gems loaded.
Step 4: Verify i18n_data is in Your Gemfile.lock
Double-check that i18n_data (0.10.0) exists in your Gemfile.lock file. If it's missing, run bundle update country_select to ensure all dependencies are properly resolved and added to the lock file.
Step 5: Update Bundler (Optional but Recommended)
Your Bundler version (2.1.4) is a bit older—updating to the latest version can resolve environment inconsistencies:
gem install bundler bundle update
After trying these steps, restart your server with bundle exec rails s and the error should be gone.
内容的提问来源于stack exchange,提问作者Dylan

