Daily Note - December 22, 2021

Published

Business

gem list rails --installed
Invalid gemspec in [/Users/moncef/.gem/ruby/2.7.4/specifications/jekyll-4.2.1.gemspec]: undefined local variable or method `d' for Gem::Specification:Class
true

And then when I ran bundle install, I got this:

Bundler 2.3.0 is running, but your lockfile was generated with 2.2.30. Installing Bundler 2.2.30 and restarting using that version.
Invalid gemspec in [/Users/moncef/.gem/ruby/2.7.4/specifications/jekyll-4.2.1.gemspec]: undefined local variable or method `d' for Gem::Specification:Class

Opening a new tab, then running rails c worked fine. bi worked fine as well, but gem list did not. gem env works. Aha, running cat /Users/moncef/.gem/ruby/2.7.4/specifications/jekyll-4.2.1.gemspec shows there’s a stray d at the end of the file, on a new line, after the last end.

Fixed it with rm -rf ~/.gem/ruby/2.7.4, then running my script again, which reinstalled jekyll and rails. Since Jekyll was the only gem affected, I could have removed that stray d from just that gemspec instead of removing all gems.

It turns out this was a known bug recently introduced in Rubygems. I summarized the issue and how to fix it in this post.

I’m trying to update Bundler in my project to the latest version, but bundle update --bundler doesn’t seem to work anymore. Before, it used to provide a command to run to update, but now it’s looking at the one in the lockfile and installing that version. Looks like that’s a known issue as well.

Ohana

Home

Todo