bundix icon indicating copy to clipboard operation
bundix copied to clipboard

You have already activated bundler 1.16.1, but your Gemfile requires bundler 1.14.6.

Open jerrymarino opened this issue 7 years ago • 2 comments

Good afternoon! I'm hoping to use bundix to manage the installation of some ruby gems, but am running into issues.

Under bundix, I'm using the following Gemfile:

source 'https://rubygems.org'
gem 'cocoapods', '1.1.1'
gem 'earlgrey', '0.1.5'
gem 'xcpretty', '0.2.4'
gem 'fastlane', '2.55.0'
gem 'jazzy', '0.8.3'
gem 'fui', '~> 0.4.0'

But when I try to use any of the gems, I get the error message:

[nix-shell:~/Projects/ios2]$ fastlane
--
/nix/store/gzifhsc6nsakp1dhj8krp1zna4dkalzs-bundler-1.14.6/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:40:in `block in setup': You have already activated bundler 1.16.1, but your Gemfile requires bundler 1.14.6. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
from /nix/store/ypvvh2vg68ybgr988x0pjdxvj8ih0vb5-ruby-2.4.3/lib/ruby/2.4.0/forwardable.rb:229:in `each'
from /nix/store/ypvvh2vg68ybgr988x0pjdxvj8ih0vb5-ruby-2.4.3/lib/ruby/2.4.0/forwardable.rb:229:in `each'
from /nix/store/gzifhsc6nsakp1dhj8krp1zna4dkalzs-bundler-1.14.6/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:25:in `map'
from /nix/store/gzifhsc6nsakp1dhj8krp1zna4dkalzs-bundler-1.14.6/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:25:in `setup'
from /nix/store/gzifhsc6nsakp1dhj8krp1zna4dkalzs-bundler-1.14.6/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler.rb:102:in `setup'
from /nix/store/7hslg2r9ayvm1jzzx6znvkwhaimv5gib-pinterest/bin/fastlane:16:in `<main>'

Setup:

  • running the latest version of nix 2.0.2 but it reproduces on all versions of nix
  • bundler-1.16.1 installed locally on my system, which seems to cause problems with the nix installation.

It looks like there may be a conflict in the installation script that causes this. Do you know of how to fix this?

jerrymarino avatar May 10 '18 20:05 jerrymarino

I am encountering the same problem, but I do not have any system-wide or user-environment version of bundler installed as far as I can tell, only one in a nix build environment.

timor avatar Jun 21 '18 20:06 timor

Hey @timor I managed to find a workaround for this one after digging into the code. I'm not sure if this is a bug or a user error. The default bundler loaded with bundlerEnv is basically a pass through, so it seems to pollutes the nix environment with the machine bundle installation.

My nix config now looks like this:

gems = bundlerEnv {
    name = "pinterest";
    inherit ruby_2_3;
    gemfile = ./Gemfile;
    lockfile = ./Gemfile.lock;
    gemset = ./gemset.nix;
};

After making the change:

+# The default bundler loaded with `bundlerEnv` is basically a pass through,
+# so don't use bundler as an input to nix, unless necessary.
+# Bundler is used only as an installation means with bundix
 let
   gems = bundlerEnv {
     name = "pinterest";
   buildInputs = [
     # Ruby
     ruby_2_3
-    bundler
-    bundix

I hope it helps! I'm not really sure what the direction for fixing this would be.

jerrymarino avatar Jun 22 '18 00:06 jerrymarino