I am using Bundler for my Rails application. When I list installed bundler gems it lists 1.4.0.pre.1 and 1.3.15 and running bundler -v yields 1.4.0.pre.1 (which is what i want).
However, when I try to run my application it says current bundler version is 1.0.15. This version is not installed as a gem and I cannot figure out how to remove it (gem uninstall bundler -v 1.0.15 wont work since this version is not installed as a gem).
I have tried updating and installing new versions, but nothing is working. Please help, I've been stuck for hours. Thank you.
Try running:
$ which -a bundle
This will tell you the location of all the instances of bundler found on your computer.
From there, you should be able to locate the offending version of bundler and uninstall it.
This worked for me when using vagrant
[vagrant#precise32:/vagrant (master)]$ sudo gem install bundler
Fetching: bundler-1.11.2.gem (100%)
Successfully installed bundler-1.11.2
1 gem installed
try running this on you app console:
bundle update
Related
I'm having trouble creating a new Rails app. I'm using a fresh WSL2 + Ubuntu 18.04 install.
Long story short, I followed the Rails installation procedure from https://gorails.com/setup/windows/10 but when installing bundle using gem install bundler, I end up with 2 bundler versions (2.1.2 and 2.1.4).
If I stick with 2.1.2 webpacker throws an error, so I definitely need to install the newest version. The problem is, when I install 2.1.4 the default version remains 2.1.2, so then I go to cd /.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/specifications/default and remove bundler-2.1.2.gemspec, and then I do a gem install bundler --default to get only v2.1.4 as default:
gem list bundler
*** LOCAL GEMS ***
bundler (default: 2.1.4)
But here is the problem; if I run bundler -v I get:
bundler -v
Bundler version 2.1.2
But the real problem is that, when running rails new, it clearly tries to use 2.1.2 which inevitably fails.
How can I solve this?
Thank you
Try gem uninstall bundler --version 2.1.2.
From the app directory run these commands:
gem install bundler
bundle update --bundler
bundle install
This rebuilds the Gemfile.lock with the correct Bundler version.
EDIT: You can create the directory first with rails new my_rails_app, then do cd .. ; rails new my_rails_app after running the above commands.
I'm trying to set up a ruby project and rather new to the process of automating via bundle. However when I try to execute any bundle command I'm met with the following error:
/usr/local/bin/bundle:26:in `load': cannot load such file -- /usr/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/exe/bundle (LoadError)
from /usr/local/bin/bundle:26:in `<main>'
I have tried removing and reinstalling Ruby, as well as removing the bundler gem itself. But to no avail. My Rubygems version is 2.3.0 and the Ruby version is 2.3.1 which is the latest stable version for Ubuntu
Problem related to bundler==1.16.1 try to reinstall with bundler=1.16.0 for now.
gem uninstall bundler -x
gem install bundler -v 1.16.0 --force
More info and bug report can be found here: https://github.com/bundler/bundler/issues/6227
I was able to uninstall bundler -v '1.16.1' as described by Mr.Coffee, but in gem list it was still listed and marked as default.
I created a symlink then - very hacky, but the only thing which worked for me:
ln -sf /usr/lib/ruby/gems/2.3.0/gems/bundler-1.16.0 /usr/lib/ruby/gems/2.3.0/gems/bundler-1.16.1
The gem requesting bundler works now.
I am trying to run "bundle update", but I keep getting the error message:
An error occurred while installing rack (2.0.1), and Bundler cannot continue.
Make sure that `gem install rack -v '2.0.1'` succeeds before bundling.
Then I install rack 2.0.1:
sudo gem install rack -v 2.0.1
Successfully installed rack-2.0.1
Parsing documentation for rack-2.0.1
Done installing documentation for rack after 2 seconds
1 gem installed
Then I even ran "rbenv rehash", and I run "bundle update" again and the same error message shows up. How do I get Bundler to recognize the new gem?
Make sure you have the "bundler" installed from the ruby version installed by rbenv first. Then, check the ruby version in that directory. It should be the one that you installed from rbenv or rvm. After these, if you are installing something just don't use sudo before bundle. Because bundle is from the rbenv ruby version. If the rbenv rehash doesn't work, just restart the bash and check.
If the without sudo thing needs permission, you are most likely using the bundler that was installed by your system ruby as sudo gem install bundler.
Try reinstalling bundler without a sudo like gem install bundler and retry.
Even if that doesn't work, remove the Gemfile.lock in your directory. Remove any version of rack mentioned in your Gemfile if any. Just have the gem name like gem 'rack' and try bundle install again. The gem that you could install with sudo was stored for the system ruby, not the one you have installed through rbenv.
When you ran sudo install, your gem most probably got installed under a different directory. When using Rbenv or VRM, you shouldn't use sudo.
First of all you could try uninstalling the gem from your system gems and doing it again without sudo.
Going into extremes you could completely reinstall your rbenv with gems (and while at it switch to RVM, personally I think its easier to manage). After that try to bundle install everything again without sudo and it should work.
I am a newbie when it comes to working with gems so pardon me if i'm getting my facts wrong.
I want to update Bundler from v1.3.5 to the latest version (v1.5.3) so I tried doing:
sudo gem install bundler --pre
the command line outputs:
Fetching: bundler-1.5.3.gem (100%)Fetching: bundler-1.5.3.gem
Successfully installed bundler-1.5.3
Parsing documentation for bundler-1.5.3
Installing ri documentation for bundler-1.5.3
Done installing documentation for bundler after 4 seconds
1 gem installed
but when I do gem list or bundle --version, it shows that i'm still using the old version (v1.3.5). This goes to all my other gems. I tried updating Susy, Sass and Compass the same way, but it doesn't get updated even though it says that it was installed successfully.
Any ideas? TIA
Fixed it. It seems that if you add sudo when installing gems, it installs the gem on a different directory from the one used when you don't use sudo. I saw this when I did sudo gem list and it displayed different results from a normal gem list command.
To be able to add gems without sudo I just did chown -R [current_user] [ruby_directory]
Run bundle update on the command line. This will update your gems in your app.
Need a bit of help with installing Ruby and RoR
I installed everything initially last weekend (15/09/2012) including
Ruby, RoR and RubyMine. I've just opened a Command Prompt on my win 7
64bit box and ran:
$ rails --version
which to my surprise returned 2.3.14 as I was expecting to see 3.2.8
I then ran:
$ gem install rails
Which output:
Successfully installed rails-3.2.8
1 gem installed
Installing ri documentation for rails-3.2.8...
Installing RDoc documentation for rails-3.2.8...
Then running rails --version again still outputs 2.3.14
I'm a bit confused why a new install (following the instructions here
http://rubyonrails.org/download) seems to have installed a very old
version.
How do I get the latest version installed?
Thanks,
Sounds like you have both versions installed. Run "gem uninstall rails" and it will list the versions and ask which one you want to remove. Then chose the old one to remove.
I've gotten a bit further now. I ran:
F:\>gem cleanup rails
Cleaning up installed gems... Attempting to uninstall rails-2.3.14
You have requested to uninstall the gem:
rails-2.3.14
restful_authentication-1.1.6 depends on [rails (~> 2.3.4)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn] y
Executables and scripts will remain installed.
Successfully uninstalled rails-2.3.14
Clean Up Complete
F:\>gem uninstall restful_authentication
Successfully uninstalled restful_authentication-1.1.6
F:\>gem install rails
Successfully installed rails-3.2.8
1 gem installed
Installing ri documentation for rails-3.2.8...
Installing RDoc documentation for rails-3.2.8...
F:\>rails -v
C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems.rb:317:in `bin_path': can't find ge
m rails ([">= 0"]) with executable rails (Gem::GemNotFoundException)
from C:/Ruby193/bin/rails:23:in `<main>'
So now it's telling me that it's installed rails successfully but now errors when I query it's version.