Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

bundler trying to install to system gems instead of GEM_HOME #5915

Closed
mockdeep opened this issue Aug 3, 2017 · 15 comments
Closed

bundler trying to install to system gems instead of GEM_HOME #5915

mockdeep opened this issue Aug 3, 2017 · 15 comments

Comments

@mockdeep
Copy link

mockdeep commented Aug 3, 2017

I'm having trouble installing gems on my system. I'm using RVM (version 1.29.2) and would expect gems to be installed in my home .rvm directory rather than needing to be installed as super user. It seems to happen only on repos I haven't touched in a while, but when I run bundle, I get the following error:

Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies...
Using ast 2.3.0


Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle install --path vendor/bundle

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

  Password:

GEM_HOME is configured as /home/fletch/.rvm/gems/ruby-2.3.3

ruby:

$ which ruby
/usr/share/rvm/rubies/ruby-2.3.3/bin/ruby
$ which bundle
/home/fletch/.rvm/gems/ruby-2.3.3/bin/bundle
$ bundler --version
Bundler version 1.14.6
$ gem --version
2.6.11

I checked the permissions on the $GEM_HOME directory and they're all my user. I can fix the issue on a per-repo basis by typing bundle --path $GEM_HOME, but that gets awkward when we upgrade ruby versions. What am I missing?

Another side note, I can't seem to uninstall gems. Not sure if it's related, but when I run gem uninstall typhoeus, I get no output and the gem is still there.

@arbonap
Copy link
Contributor

arbonap commented Aug 3, 2017

Hi @mockdeep! 👋🏽 Could you please enter the output of bundle env?

@mockdeep
Copy link
Author

mockdeep commented Aug 3, 2017

Sure, the short version when I'm not in a project directory:

Environment

Bundler   1.14.6
Rubygems  2.6.12
Ruby      2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
GEM_HOME  /home/fletch/.rvm/gems/ruby-2.3.3
GEM_PATH  /home/fletch/.rvm/gems/ruby-2.3.3:/home/fletch/.rvm/gems/ruby-2.3.3@global
RVM       1.29.2 (latest)
Git       2.7.4
Platform  x86_64-linux
rubygems-bundler (1.4.4)

And the long version when I am in one (this is after setting the local bundle path):

Environment

Bundler   1.14.6
Rubygems  2.6.12
Ruby      2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
GEM_HOME  /home/fletch/.rvm/gems/ruby-2.3.3
GEM_PATH  /home/fletch/.rvm/gems/ruby-2.3.3:/home/fletch/.rvm/gems/ruby-2.3.3@global
RVM       1.29.2 (latest)
Git       2.7.4
Platform  x86_64-linux
rubygems-bundler (1.4.4)

Bundler settings

jobs
  Set for your local app (/home/fletch/Dropbox/projects/chalk/email-repair/.bundle/config): "4"
path
  Set for your local app (/home/fletch/Dropbox/projects/chalk/email-repair/.bundle/config): "/home/fletch/.rvm/gems/ruby-2.3.3"
disable_shared_gems
  Set for your local app (/home/fletch/Dropbox/projects/chalk/email-repair/.bundle/config): "true"

Gemfile

Gemfile

source 'https://rubygems.org'

# Specify your gem's dependencies in email_repair.gemspec
gemspec

gem 'rake'
gem 'rspec'
gem 'rubocop', '~> 0.27.0'
gem 'travis'
gem 'coveralls'

Gemfile.lock

PATH
  remote: .
  specs:
    email_repair (0.2.0)

GEM
  remote: https://rubygems.org/
  specs:
    addressable (2.4.0)
    ast (2.3.0)
    astrolabe (1.3.1)
      parser (~> 2.2)
    backports (3.6.8)
    coveralls (0.8.13)
      json (~> 1.8)
      simplecov (~> 0.11.0)
      term-ansicolor (~> 1.3)
      thor (~> 0.19.1)
      tins (~> 1.6.0)
    diff-lcs (1.2.5)
    docile (1.1.5)
    ethon (0.9.0)
      ffi (>= 1.3.0)
    faraday (0.9.2)
      multipart-post (>= 1.2, < 3)
    faraday_middleware (0.10.0)
      faraday (>= 0.7.4, < 0.10)
    ffi (1.9.10)
    gh (0.14.0)
      addressable
      backports
      faraday (~> 0.8)
      multi_json (~> 1.0)
      net-http-persistent (>= 2.7)
      net-http-pipeline
    highline (1.7.8)
    json (1.8.3)
    launchy (2.4.3)
      addressable (~> 2.3)
    multi_json (1.12.1)
    multipart-post (2.0.0)
    net-http-persistent (2.9.4)
    net-http-pipeline (1.0.1)
    parser (2.3.1.2)
      ast (~> 2.2)
    powerpack (0.0.9)
    pusher-client (0.6.2)
      json
      websocket (~> 1.0)
    rainbow (2.1.0)
    rake (11.2.2)
    rspec (3.4.0)
      rspec-core (~> 3.4.0)
      rspec-expectations (~> 3.4.0)
      rspec-mocks (~> 3.4.0)
    rspec-core (3.4.4)
      rspec-support (~> 3.4.0)
    rspec-expectations (3.4.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.4.0)
    rspec-mocks (3.4.1)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.4.0)
    rspec-support (3.4.1)
    rubocop (0.27.1)
      astrolabe (~> 1.3)
      parser (>= 2.2.0.pre.7, < 3.0)
      powerpack (~> 0.0.6)
      rainbow (>= 1.99.1, < 3.0)
      ruby-progressbar (~> 1.4)
    ruby-progressbar (1.8.1)
    simplecov (0.11.2)
      docile (~> 1.1.0)
      json (~> 1.8)
      simplecov-html (~> 0.10.0)
    simplecov-html (0.10.0)
    term-ansicolor (1.3.2)
      tins (~> 1.0)
    thor (0.19.1)
    tins (1.6.0)
    travis (1.8.2)
      backports
      faraday (~> 0.9)
      faraday_middleware (~> 0.9, >= 0.9.1)
      gh (~> 0.13)
      highline (~> 1.6)
      launchy (~> 2.1)
      pusher-client (~> 0.4)
      typhoeus (~> 0.6, >= 0.6.8)
    typhoeus (0.8.0)
      ethon (>= 0.8.0)
    websocket (1.2.3)

PLATFORMS
  ruby

DEPENDENCIES
  coveralls
  email_repair!
  rake
  rspec
  rubocop (~> 0.27.0)
  travis

BUNDLED WITH
   1.14.6

Gemspecs

email_repair.gemspec

# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'email_repair/version'
require 'English'

Gem::Specification.new do |spec|
  spec.name          = 'email_repair'
  spec.version       = EmailRepair::VERSION
  spec.authors       = ['Holman Gao', 'JT Bowler']
  spec.email         = ['holman@golmansax.com', 'jbowler2400@gmail.com']
  spec.summary       = 'Library to fix invalid emails'
  spec.homepage      = 'https://github.com/ChalkSchools/email-repair'
  spec.license       = 'MIT'

  spec.files         = Dir['{lib}/**/*', 'LICENSE', 'README.md']
  spec.executables   = spec.files.grep(/^bin\//) { |f| File.basename(f) }
  spec.test_files    = Dir['spec/**/*']
  spec.require_paths = ['lib']
end

@KuttKatrea
Copy link

I'm also experiencing this problem.

Trying with old versions of bundler, this works fine until 1.13.7, starting with 1.14 the BUNDLE_HOME and GEM_HOME variables are ignored

@segiddins
Copy link
Member

Please try with the latest version, 1.15.3

@mockdeep
Copy link
Author

mockdeep commented Aug 3, 2017

Just tried with the latest bundler and still having the same issue:

Bundler   1.15.3
Rubygems  2.6.12
Ruby      2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
GEM_HOME  /home/fletch/.rvm/gems/ruby-2.3.3
GEM_PATH  /home/fletch/.rvm/gems/ruby-2.3.3:/home/fletch/.rvm/gems/ruby-2.3.3@global
RVM       1.29.2 (latest)
Git       2.7.4
Platform  x86_64-linux
OpenSSL   OpenSSL 1.0.2g  1 Mar 2016
rubygems-bundler (1.4.4)

Bundler settings

jobs
  Set for your local app (/home/fletch/Dropbox/projects/chalk/email-repair/.bundle/config): "4"

Gemfile

Gemfile

source 'https://rubygems.org'

# Specify your gem's dependencies in email_repair.gemspec
gemspec

gem 'rake'
gem 'rspec'
gem 'rubocop', '~> 0.27.0'
gem 'travis'
gem 'coveralls'

Gemfile.lock

PATH
  remote: .
  specs:
    email_repair (0.2.0)

GEM
  remote: https://rubygems.org/
  specs:
    addressable (2.4.0)
    ast (2.3.0)
    astrolabe (1.3.1)
      parser (~> 2.2)
    backports (3.6.8)
    coveralls (0.8.13)
      json (~> 1.8)
      simplecov (~> 0.11.0)
      term-ansicolor (~> 1.3)
      thor (~> 0.19.1)
      tins (~> 1.6.0)
    diff-lcs (1.2.5)
    docile (1.1.5)
    ethon (0.9.0)
      ffi (>= 1.3.0)
    faraday (0.9.2)
      multipart-post (>= 1.2, < 3)
    faraday_middleware (0.10.0)
      faraday (>= 0.7.4, < 0.10)
    ffi (1.9.10)
    gh (0.14.0)
      addressable
      backports
      faraday (~> 0.8)
      multi_json (~> 1.0)
      net-http-persistent (>= 2.7)
      net-http-pipeline
    highline (1.7.8)
    json (1.8.3)
    launchy (2.4.3)
      addressable (~> 2.3)
    multi_json (1.12.1)
    multipart-post (2.0.0)
    net-http-persistent (2.9.4)
    net-http-pipeline (1.0.1)
    parser (2.3.1.2)
      ast (~> 2.2)
    powerpack (0.0.9)
    pusher-client (0.6.2)
      json
      websocket (~> 1.0)
    rainbow (2.1.0)
    rake (11.2.2)
    rspec (3.4.0)
      rspec-core (~> 3.4.0)
      rspec-expectations (~> 3.4.0)
      rspec-mocks (~> 3.4.0)
    rspec-core (3.4.4)
      rspec-support (~> 3.4.0)
    rspec-expectations (3.4.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.4.0)
    rspec-mocks (3.4.1)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.4.0)
    rspec-support (3.4.1)
    rubocop (0.27.1)
      astrolabe (~> 1.3)
      parser (>= 2.2.0.pre.7, < 3.0)
      powerpack (~> 0.0.6)
      rainbow (>= 1.99.1, < 3.0)
      ruby-progressbar (~> 1.4)
    ruby-progressbar (1.8.1)
    simplecov (0.11.2)
      docile (~> 1.1.0)
      json (~> 1.8)
      simplecov-html (~> 0.10.0)
    simplecov-html (0.10.0)
    term-ansicolor (1.3.2)
      tins (~> 1.0)
    thor (0.19.1)
    tins (1.6.0)
    travis (1.8.2)
      backports
      faraday (~> 0.9)
      faraday_middleware (~> 0.9, >= 0.9.1)
      gh (~> 0.13)
      highline (~> 1.6)
      launchy (~> 2.1)
      pusher-client (~> 0.4)
      typhoeus (~> 0.6, >= 0.6.8)
    typhoeus (0.8.0)
      ethon (>= 0.8.0)
    websocket (1.2.3)

PLATFORMS
  ruby

DEPENDENCIES
  coveralls
  email_repair!
  rake
  rspec
  rubocop (~> 0.27.0)
  travis

BUNDLED WITH
   1.14.6

Gemspecs

email_repair.gemspec

# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'email_repair/version'
require 'English'

Gem::Specification.new do |spec|
  spec.name          = 'email_repair'
  spec.version       = EmailRepair::VERSION
  spec.authors       = ['Holman Gao', 'JT Bowler']
  spec.email         = ['holman@golmansax.com', 'jbowler2400@gmail.com']
  spec.summary       = 'Library to fix invalid emails'
  spec.homepage      = 'https://github.com/ChalkSchools/email-repair'
  spec.license       = 'MIT'

  spec.files         = Dir['{lib}/**/*', 'LICENSE', 'README.md']
  spec.executables   = spec.files.grep(/^bin\//) { |f| File.basename(f) }
  spec.test_files    = Dir['spec/**/*']
  spec.require_paths = ['lib']
end

@segiddins
Copy link
Member

Does it also happen without rubygems-bundler?

@mockdeep
Copy link
Author

mockdeep commented Aug 4, 2017

Yeah, still see it after uninstalling:

Environment

Bundler   1.15.3
Rubygems  2.6.12
Ruby      2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
GEM_HOME  /home/fletch/.rvm/gems/ruby-2.3.3
GEM_PATH  /home/fletch/.rvm/gems/ruby-2.3.3:/home/fletch/.rvm/gems/ruby-2.3.3@global
RVM       1.29.2 (latest)
Git       2.7.4
Platform  x86_64-linux
OpenSSL   OpenSSL 1.0.2g  1 Mar 2016

@segiddins
Copy link
Member

I can't repro this locally, things are defaulting to GEM_HOME as expected for me

@mockdeep
Copy link
Author

@segiddins Okay, what can I do to help get more useful info? If there's anything I can try on my end, I'd be happy to. Otherwise, I'll see if I can find some time to dig through bundler myself and figure out why things aren't working as expected.

@segiddins
Copy link
Member

Can you tell us where Bundler is installing instead of the gem home?

@mockdeep
Copy link
Author

Hmm, if I put in my sudo password, it actually ends up just installing them into the same location, just as root.

$ bundle show rb-fsevent
/home/fletch/.rvm/gems/ruby-2.3.3/gems/rb-fsevent-0.9.8
$ ls -l /home/fletch/.rvm/gems/ruby-2.3.3/gems/ | grep rb-fsevent
drwxr-xr-x  5 fletch fletch 4096 Jul  4 06:55 rb-fsevent-0.10.2
drwxr-xr-x  5 root   root   4096 Aug 11 16:00 rb-fsevent-0.9.8

Maybe the issue isn't that it doesn't respect GEM_HOME, but that for some reason it thinks I'm trying to install to my system ruby and need sudo permissions to do it?

@mockdeep
Copy link
Author

mockdeep commented Aug 11, 2017

Okay, so I went and imploded rvm. There were some directories that had the wrong permissions and not sure if they were that way before I put in my password for bundle, though I suspect they were. After reinstalling rvm and bundler, however, all is good. @KuttKatrea are you still seeing issues? If so, can you try rvm cleanup all and see if it gets any permissions errors? You may also want to recursively change owner/group for your ~/.rvm folder to make sure everything is owned by you and not root. Here's a link that may be helpful to that end.

@KuttKatrea
Copy link

Well, I'm not using RVM. But I'll check if I may also have a permission problem.

@lain0
Copy link

lain0 commented Aug 19, 2017

maybe you have 2 rvm in your system try

which rvm
rvm env

@segiddins
Copy link
Member

Closing because I feel confident this is ruby installation issue rather than a bundler issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants