Rubygems: Vendored Bundler fails running `bundle gem` due to missing template files

Created on 4 Nov 2017  ·  3Comments  ·  Source: rubygems/rubygems

I'm having the following problem:

I want to scaffold a new Ruby Gem by running bundle gem foo --verbose but the command fails with the following error message:

$ bundle gem foo --verbose
Running `bundle gem foo --verbose` with bundler 1.16.0
Creating gem 'foo'...
MIT License enabled in config
Code of conduct enabled in config
Could not find "newgem/Gemfile.tt" in any of your source paths. Your current source paths are: 
/Users/sebroeder/.rbenv/versions/2.4.2/lib/ruby/site_ruby/2.4.0/bundler/templates

Checking manually confirms that there is indeed no newgem/Gemfile.tt in the mentioned path:

tree /Users/sebroeder/.rbenv/versions/2.4.2/lib/ruby/site_ruby/2.4.0/bundler/templates
/Users/sebroeder/.rbenv/versions/2.4.2/lib/ruby/site_ruby/2.4.0/bundler/templates
└── gems.rb

If you compare this with https://github.com/bundler/bundler/tree/1-16-stable/lib/bundler/templates, it seems like there are files missing from the Bundler gem that is vendored with RubyGems.

This issue is related to:

  • [ ] Network problems
  • [x] Installing a library
  • [ ] Publishing a library
  • [x] The command line gem
  • [ ] Other

This is on a clean installation, with only the default gems installed:

$ gem list

*** LOCAL GEMS ***

bigdecimal (default: 1.3.0)
bundler (default: 1.16.0)
did_you_mean (1.1.0)
io-console (default: 0.4.6)
json (default: 2.0.4)
minitest (5.10.1)
net-telnet (0.1.1)
openssl (default: 2.0.5)
power_assert (0.4.1)
psych (default: 2.2.2)
rake (12.0.0)
rdoc (default: 5.0.0)
rubygems-update (2.7.1)
test-unit (3.2.3)
xmlrpc (0.2.1)

Here are my current environment details:

$ gem env version
2.7.1
$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.7.1
  - RUBY VERSION: 2.4.2 (2017-09-14 patchlevel 198) [x86_64-darwin16]
  - INSTALLATION DIRECTORY: /Users/sebroeder/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0
  - USER INSTALLATION DIRECTORY: /Users/sebroeder/.gem/ruby/2.4.0
  - RUBY EXECUTABLE: /Users/sebroeder/.rbenv/versions/2.4.2/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/sebroeder/.rbenv/versions/2.4.2/bin
  - SPEC CACHE DIRECTORY: /Users/sebroeder/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/sebroeder/.rbenv/versions/2.4.2/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-16
  - GEM PATHS:
     - /Users/sebroeder/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0
     - /Users/sebroeder/.gem/ruby/2.4.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/sebroeder/.rbenv/versions/2.4.2/bin
     - /usr/local/Cellar/rbenv/1.1.1/libexec
     - /Users/sebroeder/.rbenv/shims
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin

I will abide by the code of conduct.

Most helpful comment

Yeah, I'm hitting this, too (eg here). It's pretty rough, b/c downgrading Rubygems doesn't help since it's installed as a default gem or something. I can't uninstall it via the interface, I did eventually remove it from my system, I was trying to be smart about it, but in the end, I just sort of nuked everything that said "bundler", and all non-default rubygems. Then I was back to system rubygems, which was able to install and use non-vendored bundler.

All 3 comments

Yeah, I'm hitting this, too (eg here). It's pretty rough, b/c downgrading Rubygems doesn't help since it's installed as a default gem or something. I can't uninstall it via the interface, I did eventually remove it from my system, I was trying to be smart about it, but in the end, I just sort of nuked everything that said "bundler", and all non-default rubygems. Then I was back to system rubygems, which was able to install and use non-vendored bundler.

Was this page helpful?
0 / 5 - 0 ratings