简体   繁体   中英

Bundle install doesn't install gem from private git repo

Something strange is happening, everything used to work fine a few hours ago.

I have a private gem as dependency to a project. I've added the private gem git repo as follows:

gem 'my-awesome-gem', '>=1.2.3', git: 'https://john:pass123@bitbucket.org/johndoe/my-awesome-gem'

When doing bundle install it shows:

...
Using my-awesome-gem 1.2.3 from https://john:pass123@bitbucket.org/johndoe/my-awesome-gem (at master@bc19e27)
Bundle complete! 5 Gemfile dependencies, 21 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

But this gem doesn't show when I do gem list . Also, when I do pry -r my-awesome-gem or require it in the project it returns:

! Unable to load application: LoadError: cannot load such file -- my-awesome-gem
/Users/johndoe/.rbenv/versions/2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- my-awesome-gem (LoadError)
...

I've been playing around for a few hours but can't find the problem. I've tried reinstalling ruby via rbenv. I'm using Ruby 2.4.1 via rbenv.

What am I doing wrong?

When using Bundler you must engage Bundler in any code you use. That means either:

require 'bundler/setup'
require 'my-awesome-gem'

Or:

pry -r bundler/setup -r my-awesome-gem

The gem is installed, it's just not in your $LOAD_PATH until you get Bundler to load in the Gemfile and find all the dependencies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM