Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundle can't find gem that is clearly installed

I'm having a really weird issue in which I can clearly see that a gem file is installed and so can bundle, but then when I try to run it I get an error that bundle can't find it.

Gem File:

source "https://rubygems.org/"

gem 'kitchen-terraform'

Bundle env:

## Environment

```
Bundler       1.16.2
  Platforms   ruby, x64-mingw32
Ruby          2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32]
  Full Path   C:/Ruby25-x64/bin/ruby.exe
  Config Dir  C:/ProgramData
RubyGems      2.7.6
  Gem Home    C:/Ruby25-x64/lib/ruby/gems/2.5.0
  Gem Path    C:/Users/rperkins/.gem/ruby/2.5.0;C:/Ruby25-x64/lib/ruby/gems/2.5.0
  User Path   C:/Users/rperkins/.gem/ruby/2.5.0
  Bin Dir     C:/Ruby25-x64/bin
Tools
  Git         2.7.2.windows.1
  RVM         not installed
  rbenv       not installed
  chruby      not installed
```

## Bundler Build Metadata

```
Built At          2018-05-16
Git SHA           9f7bf0ac3
Released Version  true
```

## Gemfile

### Gemfile

```ruby
source "https://rubygems.org/"

gem 'kitchen-terraform'
```

### Gemfile.lock

```
GEM
  remote: https://rubygems.org/
  specs:
    addressable (2.5.2)
      public_suffix (>= 2.0.2, < 4.0)
    aws-sdk (2.11.65)
      aws-sdk-resources (= 2.11.65)
    aws-sdk-core (2.11.65)
      aws-sigv4 (~> 1.0)
      jmespath (~> 1.0)
    aws-sdk-resources (2.11.65)
      aws-sdk-core (= 2.11.65)
    aws-sigv4 (1.0.2)
    azure_mgmt_resources (0.16.0)
      ms_rest_azure (~> 0.10.0)
    builder (3.2.3)
    coderay (1.1.2)
    concurrent-ruby (1.0.5)
    declarative (0.0.10)
    declarative-option (0.1.0)
    diff-lcs (1.3)
    digest-crc (0.4.1)
    docker-api (1.34.2)
      excon (>= 0.47.0)
      multi_json
    domain_name (0.5.20180417)
      unf (>= 0.0.5, < 1.0.0)
    dry-configurable (0.7.0)
      concurrent-ruby (~> 1.0)
    dry-container (0.6.0)
      concurrent-ruby (~> 1.0)
      dry-configurable (~> 0.1, >= 0.1.3)
    dry-core (0.4.6)
      concurrent-ruby (~> 1.0)
    dry-equalizer (0.2.1)
    dry-inflector (0.1.2)
    dry-logic (0.4.2)
      dry-container (~> 0.2, >= 0.2.6)
      dry-core (~> 0.2)
      dry-equalizer (~> 0.2)
    dry-types (0.13.2)
      concurrent-ruby (~> 1.0)
      dry-container (~> 0.3)
      dry-core (~> 0.4, >= 0.4.4)
      dry-equalizer (~> 0.2)
      dry-inflector (~> 0.1, >= 0.1.2)
      dry-logic (~> 0.4, >= 0.4.2)
    dry-validation (0.12.0)
      concurrent-ruby (~> 1.0)
      dry-configurable (~> 0.1, >= 0.1.3)
      dry-core (~> 0.2, >= 0.2.1)
      dry-equalizer (~> 0.2)
      dry-logic (~> 0.4, >= 0.4.0)
      dry-types (~> 0.13.1)
    erubis (2.7.0)
    excon (0.62.0)
    faraday (0.15.2)
      multipart-post (>= 1.2, < 3)
    faraday-cookie_jar (0.0.6)
      faraday (>= 0.7.4)
      http-cookie (~> 1.0.0)
    faraday_middleware (0.12.2)
      faraday (>= 0.7.4, < 1.0)
    ffi (1.9.25-x64-mingw32)
    google-api-client (0.19.8)
      addressable (~> 2.5, >= 2.5.1)
      googleauth (>= 0.5, < 0.7.0)
      httpclient (>= 2.8.1, < 3.0)
      mime-types (~> 3.0)
      representable (~> 3.0)
      retriable (>= 2.0, < 4.0)
    google-cloud (0.51.1)
      google-cloud-bigquery (~> 1.1)
      google-cloud-bigquery-data_transfer (~> 0.1)
      google-cloud-container (~> 0.1)
      google-cloud-dataproc (~> 0.1)
      google-cloud-datastore (~> 1.4)
      google-cloud-dlp (~> 0.1)
      google-cloud-dns (~> 0.28)
      google-cloud-error_reporting (~> 0.30)
      google-cloud-firestore (~> 0.21)
      google-cloud-language (~> 0.30)
      google-cloud-logging (~> 1.5)
      google-cloud-monitoring (~> 0.27)
      google-cloud-os_login (~> 0.1)
      google-cloud-pubsub (~> 0.30)
      google-cloud-resource_manager (~> 0.29)
      google-cloud-spanner (~> 1.3)
      google-cloud-speech (~> 0.29)
      google-cloud-storage (~> 1.10)
      google-cloud-trace (~> 0.31)
      google-cloud-translate (~> 1.2)
      google-cloud-video_intelligence (~> 1.0)
      google-cloud-vision (~> 0.28)
    google-cloud-bigquery (1.5.0)
      concurrent-ruby (~> 1.0)
      google-api-client (~> 0.19.8)
      google-cloud-core (~> 1.2)
      googleauth (~> 0.6.2)
    google-cloud-bigquery-data_transfer (0.1.0)
      google-gax (~> 1.0)
    google-cloud-container (0.1.0)
      google-gax (~> 1.0.1)
    google-cloud-core (1.2.0)
      google-cloud-env (~> 1.0)
    google-cloud-dataproc (0.1.0)
      google-gax (~> 1.0.0)
    google-cloud-datastore (1.4.0)
      google-cloud-core (~> 1.2)
      google-gax (~> 1.0)
      google-protobuf (~> 3.3)
    google-cloud-dlp (0.4.0)
      google-gax (~> 1.0)
    google-cloud-dns (0.28.0)
      google-api-client (~> 0.19.0)
      google-cloud-core (~> 1.2)
      googleauth (~> 0.6.2)
      zonefile (~> 1.04)
    google-cloud-env (1.0.1)
      faraday (~> 0.11)
    google-cloud-error_reporting (0.30.0)
      google-cloud-core (~> 1.2)
      google-gax (~> 1.0)
      stackdriver-core (~> 1.3)
    google-cloud-firestore (0.21.1)
      concurrent-ruby (~> 1.0)
      google-cloud-core (~> 1.2)
      google-gax (~> 1.0)
    google-cloud-language (0.30.0)
      google-gax (~> 1.0)
    google-cloud-logging (1.5.0)
      google-cloud-core (~> 1.2)
      google-gax (~> 1.0)
      stackdriver-core (~> 1.3)
    google-cloud-monitoring (0.28.0)
      google-gax (~> 1.0)
    google-cloud-os_login (0.1.0)
      google-gax (~> 1.0.0)
    google-cloud-pubsub (0.30.2)
      concurrent-ruby (~> 1.0)
      google-cloud-core (~> 1.2)
      google-gax (~> 1.0)
      grpc-google-iam-v1 (~> 0.6.9)
    google-cloud-resource_manager (0.29.0)
      google-api-client (~> 0.19.8)
      google-cloud-core (~> 1.2)
      googleauth (~> 0.6.2)
    google-cloud-spanner (1.4.0)
      concurrent-ruby (~> 1.0)
      google-cloud-core (~> 1.2)
      google-gax (~> 1.0)
      grpc-google-iam-v1 (~> 0.6.9)
    google-cloud-speech (0.29.0)
      google-cloud-core (~> 1.2)
      google-gax (~> 1.0)
    google-cloud-storage (1.12.0)
      digest-crc (~> 0.4)
      google-api-client (~> 0.19.0)
      google-cloud-core (~> 1.2)
      googleauth (~> 0.6.2)
    google-cloud-trace (0.33.0)
      google-cloud-core (~> 1.2)
      google-gax (~> 1.0)
      stackdriver-core (~> 1.3)
    google-cloud-translate (1.2.0)
      faraday (~> 0.13)
      google-cloud-core (~> 1.2)
      googleauth (~> 0.6.2)
    google-cloud-video_intelligence (1.0.0)
      google-gax (~> 1.0)
    google-cloud-vision (0.28.0)
      google-cloud-core (~> 1.2)
      google-gax (~> 1.0)
    google-gax (1.0.1)
      google-protobuf (~> 3.2)
      googleapis-common-protos (>= 1.3.5, < 2.0)
      googleauth (~> 0.6.2)
      grpc (>= 1.7.2, < 2.0)
      rly (~> 0.2.3)
    google-protobuf (3.5.1.2-x64-mingw32)
    googleapis-common-protos (1.3.7)
      google-protobuf (~> 3.0)
      googleapis-common-protos-types (~> 1.0)
      grpc (~> 1.0)
    googleapis-common-protos-types (1.0.1)
      google-protobuf (~> 3.0)
    googleauth (0.6.2)
      faraday (~> 0.12)
      jwt (>= 1.4, < 3.0)
      logging (~> 2.0)
      memoist (~> 0.12)
      multi_json (~> 1.11)
      os (~> 0.9)
      signet (~> 0.7)
    grpc (1.12.0-x64-mingw32)
      google-protobuf (~> 3.1)
      googleapis-common-protos-types (~> 1.0.0)
      googleauth (>= 0.5.1, < 0.7)
    grpc-google-iam-v1 (0.6.9)
      googleapis-common-protos (>= 1.3.1, < 2.0)
      grpc (~> 1.0)
    gssapi (1.2.0)
      ffi (>= 1.0.1)
    gyoku (1.3.1)
      builder (>= 2.1.2)
    hashie (3.5.7)
    htmlentities (4.3.4)
    http-cookie (1.0.3)
      domain_name (~> 0.5)
    httpclient (2.8.3)
    inifile (3.0.0)
    inspec (2.2.10)
      addressable (~> 2.4)
      faraday (>= 0.9.0)
      faraday_middleware (~> 0.12.2)
      hashie (~> 3.4)
      htmlentities
      json (>= 1.8, < 3.0)
      method_source (~> 0.8)
      mixlib-log
      parallel (~> 1.9)
      parslet (~> 1.5)
      pry (~> 0)
      rspec (~> 3)
      rspec-its (~> 1.2)
      rubyzip (~> 1.1)
      semverse
      sslshake (~> 1.2)
      thor (~> 0.20)
      tomlrb (~> 1.2)
      train (~> 1.4.11)
    jmespath (1.4.0)
    json (2.1.0)
    jwt (2.1.0)
    kitchen-inspec (0.23.1)
      hashie (~> 3.4)
      inspec (>= 0.34.0, < 3.0.0)
      test-kitchen (~> 1.6)
    kitchen-terraform (3.3.1)
      dry-types (~> 0.9)
      dry-validation (~> 0.10)
      kitchen-inspec (~> 0.18)
      mixlib-shellout (~> 2.2)
      test-kitchen (~> 1.16)
    little-plugger (1.1.4)
    logging (2.2.2)
      little-plugger (~> 1.1)
      multi_json (~> 1.10)
    memoist (0.16.0)
    method_source (0.9.0)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mixlib-install (3.10.0)
      mixlib-shellout
      mixlib-versioning
      thor
    mixlib-log (2.0.4)
    mixlib-shellout (2.3.2-universal-mingw32)
      win32-process (~> 0.8.2)
      wmi-lite (~> 1.0)
    mixlib-versioning (1.2.2)
    ms_rest (0.7.2)
      concurrent-ruby (~> 1.0)
      faraday (~> 0.9)
      timeliness (~> 0.3)
    ms_rest_azure (0.10.8)
      concurrent-ruby (~> 1.0)
      faraday (~> 0.9)
      faraday-cookie_jar (~> 0.0.6)
      ms_rest (~> 0.7.2)
    multi_json (1.13.1)
    multipart-post (2.0.0)
    net-scp (1.2.1)
      net-ssh (>= 2.6.5)
    net-ssh (4.2.0)
    net-ssh-gateway (1.3.0)
      net-ssh (>= 2.6.5)
    nori (2.6.0)
    os (0.9.6)
    parallel (1.12.1)
    parslet (1.8.2)
    pry (0.11.3)
      coderay (~> 1.1.0)
      method_source (~> 0.9.0)
    public_suffix (3.0.2)
    representable (3.0.4)
      declarative (< 0.1.0)
      declarative-option (< 0.2.0)
      uber (< 0.2.0)
    retriable (3.1.2)
    rly (0.2.3)
    rspec (3.7.0)
      rspec-core (~> 3.7.0)
      rspec-expectations (~> 3.7.0)
      rspec-mocks (~> 3.7.0)
    rspec-core (3.7.1)
      rspec-support (~> 3.7.0)
    rspec-expectations (3.7.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.7.0)
    rspec-its (1.2.0)
      rspec-core (>= 3.0.0)
      rspec-expectations (>= 3.0.0)
    rspec-mocks (3.7.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.7.0)
    rspec-support (3.7.1)
    rubyntlm (0.6.2)
    rubyzip (1.2.1)
    semverse (2.0.0)
    signet (0.8.1)
      addressable (~> 2.3)
      faraday (~> 0.9)
      jwt (>= 1.5, < 3.0)
      multi_json (~> 1.10)
    sslshake (1.2.0)
    stackdriver-core (1.3.0)
      google-cloud-core (~> 1.2)
    test-kitchen (1.21.2)
      mixlib-install (~> 3.6)
      mixlib-shellout (>= 1.2, < 3.0)
      net-scp (~> 1.1)
      net-ssh (>= 2.9, < 5.0)
      net-ssh-gateway (~> 1.2)
      thor (~> 0.19)
      winrm (~> 2.0)
      winrm-elevated (~> 1.0)
      winrm-fs (~> 1.1)
    thor (0.20.0)
    timeliness (0.3.8)
    tomlrb (1.2.6)
    train (1.4.11)
      aws-sdk (~> 2)
      azure_mgmt_resources (~> 0.15)
      docker-api (~> 1.26)
      google-api-client (~> 0.19.8)
      google-cloud (~> 0.51.1)
      googleauth (~> 0.6.2)
      inifile
      json (>= 1.8, < 3.0)
      mixlib-shellout (~> 2.0)
      net-scp (~> 1.2)
      net-ssh (>= 2.9, < 5.0)
      winrm (~> 2.0)
      winrm-fs (~> 1.0)
    uber (0.1.0)
    unf (0.1.4)
      unf_ext
    unf_ext (0.0.7.5-x64-mingw32)
    win32-process (0.8.3)
      ffi (>= 1.0.0)
    winrm (2.2.3)
      builder (>= 2.1.2)
      erubis (~> 2.7)
      gssapi (~> 1.2)
      gyoku (~> 1.0)
      httpclient (~> 2.2, >= 2.2.0.2)
      logging (>= 1.6.1, < 3.0)
      nori (~> 2.0)
      rubyntlm (~> 0.6.0, >= 0.6.1)
    winrm-elevated (1.1.0)
      winrm (~> 2.0)
      winrm-fs (~> 1.0)
    winrm-fs (1.2.0)
      erubis (~> 2.7)
      logging (>= 1.6.1, < 3.0)
      rubyzip (~> 1.1)
      winrm (~> 2.0)
    wmi-lite (1.0.0)
    zonefile (1.06)

PLATFORMS
  x64-mingw32

DEPENDENCIES
  kitchen-terraform

BUNDLED WITH
   1.16.2
```

Bundle Doctor:

The Gemfile's dependencies are satisfied
No issues found with the installed bundle

Alright, awesome everything is clearly installed, so lets try this.

Bundle exec kitchen test:

Could not find aws-sdk-core-2.11.65 in any of the sources
Run `bundle install` to install missing gems.

How can this be, it was clearly installed when we ran bundle install and we can see that in the bundle env above.

Bundle info aws-sdk-core:

  * aws-sdk-core (2.11.65)
        Summary: AWS SDK for Ruby - Core
        Homepage: http://github.com/aws/aws-sdk-ruby
        Path: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.11.65

Bundle show aws-sdk-core:

C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/aws-sdk-core-2.11.65
like image 555
The Digital Ninja Avatar asked Jun 11 '18 20:06

The Digital Ninja


2 Answers

This is happening because of a path mismatch. Bundler is looking at a path which is not your local path. Either specifically mention

gem install --path

or set

BUNDLE_DISABLE_SHARED_GEMS: 0

in .bundle/config file. This is set to true(1) by default. Use this with caution though as resetting this bundler setting will enable use of system-wide installed gems.

like image 86
Kavitha Avatar answered Nov 01 '22 06:11

Kavitha


Try installing the gems in the system's directory, it might solve the problem as it seems your gems are installed in 2 separate directories C:/Users/rperkins/.gem/ruby/2.5.0 and C:/Ruby25-x64/lib/ruby/gems/2.5.0.

Install the gems with bundler using the following command:

bundle install --system
like image 2
atefth Avatar answered Nov 01 '22 06:11

atefth