bundler not found but gem list shows bundler - ruby

i use rvm and it works great.
When i type gem list it shows bundler 1.1.5 but which bundler print out: bundler not found.
I did install bundler several times but it doesn't help.
Any suggestions?

Command for bundler gem is not bundler but bundle. So just type bundle on your shell and it will works :)

I could solve this problem with:
rvm gemset use global && gem install bundler
Apparently there was a problem with the gemset. After using global gemset it works like a charm.

Related

How to install Bundler to #global gemset under RVM and is it a correct way

I am on OS X (if it matters).
If I install a Ruby using RVM, it will install Bundler by default to #global gemset
Let say I want a different version of the bundler. I assumed that all I needed to do is to execute
gem install bundler --version <SomeVersion>
However, this will install bundler to default gemset and RVM doesn't set a PATH to it.
As result, if I type bundler it will still launch a bundler which was installed with Ruby into #global
Two questions:
How can I install bundler to #global gemset.
Is this correct pattern to install bundler into #global gemset or I am missing something
This is how you can install bundler in the global gemset:
rvm #global do gem install bundler
as a practice, I don't see any issue, since bundler is never part of the gemfile in any case.
One glitch to note, if you have projects running multiple rails and ruby version (as old as 1.8.7 and rails 2.x) using newer bundler is not backwards compatible, so you'll be forced to use multiple bundler versions.

'bundle exec' complains about gem not being installed, even after 'bundle install'

I have a website using Jekyll with Github Pages. After previously messing about with versions and RVM on another computer, on this one I opted to stick with just one version of Ruby and per-project environments using bundler.
I have a pretty simple Gemfile:
[$]> cat Gemfile
source 'https://rubygems.org'
gem 'github-pages'
and bundler config:
[$]> cat .bundle/config
---
BUNDLE_PATH: env
BUNDLE_DISABLE_SHARED_GEMS: '1'
When I run any command (jekyll, gem, irb) through bundle exec, I get a dependency error:
[$]> bundle exec jekyll
Could not find RedCloth-4.2.9 in any of the sources
Run `bundle install` to install missing gems.
However, the bundle is already installed:
[$]> bundle install
Using RedCloth 4.2.9
Using i18n 0.6.11
Using json 1.8.1
[snip]
Using github-pages 29
Using bundler 1.7.7
Your bundle is complete!
It was installed into ./env
I'm at a bit of a loss as to how bundler can think the gems are installed when using one subcommand, but think they're missing when using another.
[$]> which ruby
/usr/local/bin/ruby
[$]> which bundler
/usr/local/bin/bundler
[$]> ruby --version
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
[$]> bundler --version
Bundler version 1.7.7
After deleting the env directory and reinstalling, I noticed it created subdirectories for two Ruby versions - 2.1.0 and 2.2.0. The latter was my current version of Ruby, but the directory was empty (all the gems were installed into the env/ruby/2.1.0/gems directory). This, combined with Oliver's answer about rbenv, got me thinking about mismatched versions.
I reinstalled bundler with a simple gem install bundler, reran bundle install, and all is good.
It seems in general the answer is to sort out issues with bundler installing for a different version of Ruby than you're actually using. It seems strange to me it would use one thing for bundle install and another for bundle exec, but *shrug* whatever.
I had exactly the same problem after installing rbenv as my Ruby manager. In the end I solved the problem with:
rbenv rehash
(additionally you may need to restart terminal, as per #joel-glovier's comment)
That fact it's complaining about Redcloth 4.2.9 is actually a red herring. Bundler probably can't find any of the gems but Redcloth is the first one it looks for and so it exits imediately with that error.
Basically I'd installed rbenv and ruby 2.2.2 and changed to that version with rbenv global 2.2.2 but I'd forgotten to run rbenv rehash. So I'm guessing when running bundle install it was looking at my previously used version of ruby (system ruby) to see what gems were installed but when running bundle exec jekyll serve it was looking at my new ruby version and not finding any of the gems.
I had to open ./.bundle/config and set
BUNDLE_DISABLE_SHARED_GEMS to true for bundle the gems to be properly locally stored.
I had defined BUNDLE_GEMFILE = /home/app/current/Gemfile in .bashrc file. That broke the bundle exec while deploying a new version to the server. Check with env that you don't have the BUNDLE_GEMFILE defined in your environment variables.
I added the BUNDLE_GEMFILE into the .bashrc file to ease with monit commands. Now I just define the variable in the beginning of the monit command.

bundler does not install gem in current rvm gemset if gem is from remote repository

I have selected a gemset with
rvm use ruby-2.1.2#deploy
in my gemfile I have:
gem 'transip', :git => 'git://github.com/rempargo/transip.git'
then I run bundle install and get the following output:
....
....
Installing wasabi 3.3.0
Installing savon 2.5.1
Using transip 0.4.2 from git://github.com/rempargo/transip.git (at master)
Using bundler 1.6.2
Your bundle is updated!
But when I do gem list all gems except the transip one are listed.
The other gems are not installed in gemset 'ruby-2.1.2' or 'ruby-2.1.2#global', but are really installed in the gemset ruby-2.1.2#deploy
I tried also to use bundle exec install although I never used the 'exec' before, but it does not work.
Is there a problem using bundler and rvm when using gems that uses a link to a repository?
I'm using:
Mac OS X 10.9.3 (With command-line tools installed)
rvm 1.25.26
bundler 1,6,2
P.S. This all happened after upgrading to Maverick, when some libraries where not working anymore, and I had to install ruby again with rvm.
gem list will show all the gems installed on your system
bundle show gem_namewill give you whether that gem is installed in your current application bundled gemset

gem install rails does not work

I am working on ubuntu and rvm. In any case I tried to use sudo gem (any command) it does not recognize gem as command. In addition if I use gem seperately as:
gem install rails
ERROR: Could not find a valid gem 'rails' (>= 0) in any repository
ERROR: Possible alternatives: rails
I got that error. I cannot see the reason.
rvm version 1.10.3
ruby version 1.8.7
gem version 1.6.7
What is the possible reason behind this?
Re-install all rvm and ruby and the gems, solved my problem.

How do you uninstall RVM gem?

Strange... but this is what I got :
$ gem list | grep rvm
>> rvm (1.11.3.3)
$ gem uninstall rvm
>> INFO: gem "rvm" is not installed
How can that be possible? The root of this problem probably stems from me downloading the latest RVM and finding that it does not work with the latest version of POW. Thus I had to implode RVM and reinstall an older version. Since then when I do a cap deploy, I get the classic :
`<top (required)>': RVM - Capistrano integration was extracted to a separate gem, install: `gem install rvm-capistrano` and remove the `$LOAD_PATH.unshift` line, note also the 'set :rvm_type, :user' is now the default (instead of :system). (RuntimeError)
Any ideas?
I recently encountered the same rvm error:
"RVM - Capistrano integration was extracted to a separate gem, install: gem install rvm-capistrano and remove the $LOAD_PATH.unshift line, note also the 'set :rvm_type, :user' is now the default (instead of :system). (RuntimeError)"
Doing what the error suggested did not work for me at all.
What did work for me was to do: rvm -v
When I did this I saw that my rvm version was rvm 1.13.0
Using "rvm get" I did "rvm get 1.12.0" but still got the error
Then I tried "rvm get 1.11.0" and then presto, my rvm started working again.
I'm not 100% sure what caused the error in the first place but I think it all began when I tried to upgrade rvm with rvm get stable after I was unable to install some gems. I found out that I wasn't able to install gems anymore due to the fact that I had updated my xcode to 4.3.2 and apparently Apple changed their c complier which doesn't play nice with rvm.
Hope this helps someone.
Are you in a gemset? If so, that gem might be in the interpreter's unnamed gemset or the global gemset. If so, try
rvm use 1.9.3
gem uninstall rvm
or
rvm use 1.9.3#global
gem uninstall rvm
I just ran into this error as well. The error you ran into was because of the recent capistrano update. If you add rvm-capistrano to your gemfile and remove the $LOAD-PATH.unshift line from your capistrano deployment file it should work, at least it did for me.
That would be correct. Its in the 'global' gemset. This gemset is 'mixed in' to both the 'default' gemset and any gemsets you actually create.
Thus if you have Ruby 1.9.3 installed, for example, (rvm install 1.9.3) it will be installed into that ruby's 'global'. You can verify this by doing 'gem list rvm -dl' which will show you the name, version, description, and location on the disk of the requested gem.
∴ gem list rvm -dl
*** LOCAL GEMS ***
rvm (1.11.3.3)
Authors: Wayne E. Seguin, Michal Papis
Homepage: https://rvm.beginrescueend.com/
Installed at: /home/me/.rvm/gems/ruby-1.9.3-p194#global
RVM Ruby Gem Library
∴
I don't know why you want it removed, but you would do as Abe stated as the second choice.
To give more details, RVM works with POW, this is known issue: https://github.com/37signals/pow/issues/271
the easiest solution(in project dir):
rvm env . > .powenv
The version of RVM might not be compatible with POW. You can remove RVM and then install the most current version.
The problem is that RVM 1.12 and up does not play well with Capistrano.
So uninstall your RVM, then get RVM 1.11 (rvm get 1.11.0).
Nathan got it right: https://stackoverflow.com/a/10306090/294449
You used to have to do the unshift in your deploy.rb but the latest versions of RVM have made that hack no longer necessary. Just remove it and add the rvm-capistrano gem to your Gemfile. It works like a charm.

Resources