When I Do "Bundle Update", I Get an Error from a Gem Not in My Gemfile. How to Ignore This Dependency

When I do bundle update, I get an error from a gem not in my gemfile. How do I ignore this dependency?

Another member helped me here:

Telling Bundler to exclude certain gems from a particular gem's installation

This is being marked as "trivial" with no content, but I don't want to copy/paste content that isn't mine, so just typing this out.

Bundler not ignoring the gems in the group I pass the --without option to

You mentioned in comment that nokogumbo is a dependency of another gem. Because of that it is getting installed.

if you use --without argument while doing bundle install, and if the gem which was supposed to be skipped is present as a dependancy in another Gem it will be installed.

reference for above

How to tell bundler to ignore gems that don't exist?

This is expected behaviour. From the docs:

While the --without option will skip installing the gems in the specified groups, it will still download those gems and use them to resolve the dependencies of every gem in your Gemfile(5).

Whilst an up to date Gemfile.lock might suggest that the dependencies don’t need to be resolved again, it looks like all gems are downloaded even in this case.

Telling Bundler to exclude certain gems from a particular gem's installation

There is no option for this in Bundler.

So you're left with these options:

  • Don't use twitter-bootstrap-rails. You can just copy the compiled css and js files into the proper directories under vendor/assets. You'll lose the ability to change less variables. Or you can use the compass_twitter_bootstrap gem, which uses sass instead of less.

  • Get the maintainer of the less gem to use execjs instead of commonjs and therubyracer. It would probably mean significant refactoring for the maintainer(s) if at all possible.

  • Use the :platform option in your Gemfile, to only install on OSX or Linux. Then require the parts you can use by hand, without loading less. This probably won't work.

bundle install' ignores the devise gem specified in the Gemfile

Yes, removing Gemfile.lock might help. First open and check if it really doesn't contain Devise.

You can check if Devise installed with:

gem list

You can see which version is bundled (if any) with:

bundle show devise

you can see all generators, if Devise installed it will popup in this list too.

rails generate

For dependency issues RVM is great on *nix system, I think it's copy is Pik on Win:
https://github.com/vertiginous/pik -
with this you can handle all your dependeny problems.

Hope this helped.

Does bundle update install gems that haven't been installed before

Running bundle update does two things:

  1. Update Gemfile.lock to the latest versions available, using Gemfile as the source of information for updating Gemfile.lock.

  2. Run bundle install to make sure all these gems are present in your system.

So yes, if you add a gem to Gemfile and then run bundle update, it will install this new gem for you too.

Ruby on Rails: Removing a dependency while installing a gem?

According to this doc, there's the options

-f, --[no-]force            Force gem to install, bypassing dependency checks

and

--ignore-dependencies        Do not install any required dependent gems

bundle install does not respect Gemfile.lock

First of all it'll be great if you shared the Gemfile.lock error so as to know what i particular might be causing that upgrade. But from afar I think as you said this gem is a dependency gem and it is not stated in your gemfile. It could be that another gem also depends on this gem and per that requirement it triggers an upgrade even before your supposed gem line is run which may be leading to the error. Read the error thoroughly and you can identify the gem(s) causing this.

After your update I have read around on this.
Exactly so as stated earlier on, one of these gems could be the reason why your particular gem gets updated with every bundler install. Unfortunately there is no true turn around to solving this but bundler does give a way around.
You can use the --frozen option with bundler which freezes your gemfile.lock to the current versions for each gem and does not update any gem but only installs new gems that you have. Unfortunately this has been deprecated and can only be done be done from /.bundle/config. This can be done from the command line in the root of your project.
run
bundle config frozen true to freeze bundler from updating your gems in gemfile.lock
You may have to grant write permissions to your user to be able to edit the bundle configurations.
I found this article as well from bigbinary.com



Related Topics



Leave a reply



Submit