Hi I've been having a probably trying to install the Ruby gem bundle. I follow the directions gem install bundle after I receive this message, but it still doesn't work when I type bundle -v. I also type
which bundle and receive
/Users/edmundmai/.rvm/bin/bundle
so it exists!! So why does it not work!! Is there something wrong with the mysterious $PATH that I don't get? (I'm a noob).
Here's my .bash_profile:
PATH=$PATH:~/bin
export PATH
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
Here's my .bashrc :
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Here's my gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-darwin11.3.1]
- INSTALLATION DIRECTORY: /Users/edmundmai/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd
- RUBY EXECUTABLE: /Users/edmundmai/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
- EXECUTABLE DIRECTORY: /Users/edmundmai/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-11
- GEM PATHS:
- /Users/edmundmai/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd
- /Users/edmundmai/.rvm/gems/ruby-1.9.3-p194#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "install" => "--no-rdoc --no-ri"
- "update" => "--no-rdoc --no-ri"
- REMOTE SOURCES:
- http://rubygems.org/
echo $PATH
/Users/edmundmai/.rvm/bin:/Users/edmundmai/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/bin:/Users/edmundmai/.rvm/gems/ruby-1.9.3-p194#global/bin:/Users/edmundmai/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/edmundmai/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/edmundmai/bin:/Users/edmundmai/bin
UPDATE
So after trying to go through the RoR tutorial again, I repeated a few of the steps from earlier in the chapter in one of my two terminal windows (let's call them Terminal #1 and Terminal #2). Terminal #2 still doesn't work (the command line isn't on any directory, just the default directory) while Terminal #1 (at my sample_app directory) works. I think rvm get head && rvm reload might be the key? But does that mean I have to run that every time I open my terminal? Check out my terminal #1 commands for before and after (I deleted some of the output so that it would be more clear what my input lines were):
Edmunds-MacBook-Pro:sample_app edmundmai$ bundle -v
ERROR: Gem bundler is not installed, run `gem install bundler` first.
Edmunds-MacBook-Pro:sample_app edmundmai$ gem install
ERROR: While executing gem ... (Gem::CommandLineError)
Please specify at least one gem name (e.g. gem build GEMNAME)
Edmunds-MacBook-Pro:sample_app edmundmai$ rvm -v
rvm 1.15.8 (master) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]
Edmunds-MacBook-Pro:sample_app edmundmai$ rspec spec/
No DRb server is running. Running in local process instead ...
........
Finished in 0.36709 seconds
8 examples, 0 failures
Randomized with seed 59500
Edmunds-MacBook-Pro:sample_app edmundmai$ subl .
Edmunds-MacBook-Pro:sample_app edmundmai$ bundle install --binstubs=./bundler_stubs
Using rake (0.9.2.2)
...
...
(**list of stuff)
Using uglifier (1.2.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Edmunds-MacBook-Pro:sample_app edmundmai$ bundle show bundler
/Users/edmundmai/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/bundler-1.2.0
I'm extremely unclear as to what the $PATH does. If you guys need any more info, feel free to tell me and I'll provide it.
I think this is the problem: You have bundler installed to a specific gemset, which is why it's only available when you're in your app's directory (I'm assuming there's a .rvmrc file in there).
You have a few options:
Install bundler to a global gemset. rvm gemset use global && gem install bundler
If you have Homebrew installed, just do brew install ruby and avoid rvm altogether. (There's also rbenv and ry as alternatives to rvm, but I just use 1.9.3 across all my apps, so Homebrew is fine.)
For reference, $PATH is a shell environmental variable containing a list of directories that hold executables (e.g., echo, ls, vim, etc.). It's intrinsic to shells.
Sometimes it is just that you are not sourcing rvm correctly, because you are not in a login shell (using screen?).
Type
source ~/.rvm/scripts/rvm
And use any bundle command.
Add the following line to ~/.bashrc file
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
then reload the file:
$ source ~/.bashrc
Even i had same problem,
In server rvm was not selected as default.So
rvm use 1.9.3 --default
gem install bundler
solved my problem
(Problem occurs only when using rvm)
If you are using rvm create a separate gemset, which are self-contained bundles of gems.
rvm use 1.9.3#myApplicationNameHere --create --default
myApplicationNameHere = change this to your application name
create = creates a gemset
default = means use this version of ruby and gemset as default
Here is the link to the rvm site and the relevant section https://rvm.io/gemsets/basics/
Related
I am trying to install Jekyll in a VM for my web course and it required ruby >= 2.0.0.
I've gone through installing RVM and using this to install the desired version of ruby, but I then get the following:
vagrant#precise32:~/.rvm/bin$ bash rvm list
rvm rubies
ruby-2.1.1 [ i686 ]
=* ruby-2.2.1 [ i686 ]
# => - current
# =* - current && default
# * - default
vagrant#precise32:~/.rvm/bin$ ruby -v
ruby 1.8.7 (2011-06-30
patchlevel 352) [i686-linux]
vagrant#precise32:~/.rvm/bin$ sudo gem
install jekyll ERROR: Error installing jekyll:jekyll requires Ruby version >= 2.0.0.
vagrant#precise32:~/.rvm/bin
I don't understand why it still thinks it is using version 1.8.7, as it confirms that it has installed 2.2.1.
I have done the following:
Use sudo chown to change ownership of the .gnupg folder recursively to vagrant (my system user) as defined here.
Install RVM following the instructions here.
Installed the version (2.2.1) of ruby using these instructions (https://rvm.io/rubies/installing).
Tried to install Jekyll using sudo gem install jekyll, but I get an error saying that I need ruby version 2.0 or higher.
I'm not a developer, this is an introductory web development course. Also please excuse the corrupt link, I can't post more than 2.
Update: I think I might need to do something as described here: How do I change my Ruby version using RVM?.
Also - although I installed RVM, I originally installed it using sudo apt-get which corrupted it. I uninstalled that, and ran the most recent install with curl. To use it I have to navigate to the directory and use "bash rvm list"
Add following two lines:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
to your $HOME/.profile file and restart a shell.
It seems your machine is using Its own instead by RVM.
1: rvm list # Listing install rubies will you get versions of ruby which is installed by RVM
2: rvm use < ruby-version > # for instances ruby-1.9.3-p125
3: bundle install
4: Tried to install Jekyll using sudo gem install jekyll, but I get an
error saying that I need ruby version 2.0 or higher.
For that you could try Installing Jekyll on Ubuntu 14.04
Hope this help you !!!
I just cloned my Rails app onto my new computer. Ruby 2.0.0 seemed to install with no issue, but when I run sudo bundle install inside my app, I get an error telling me I have Ruby 1.9.3 installed:
$ sudo bundle install
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
and bundle install returns this:
$ bundle install
/home/user/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler (LoadError)
from /home/user/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/bin/bundle:7:in `<main>'
I don't understand why I would have 1.9.3 installed. I used the command rvm install 2.0.0 to install Ruby.
Also, ruby -v returns:
ruby 2.0.0p643 (2015-02-25 revision 49749) [x86_64-linux]
What's going on?
Output of rvm list
$ rvm list
rvm rubies
=* ruby-2.0.0-p643 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Because you're using rvm, you shouldn't ever need to use sudo on any of your commands. Using sudo is likely running the globally installed 1.9.3 version.
If you just installed Ruby 2.0.0 and haven't done anything else, then you most likely need to install bundler first before using it:
gem install bundler
Once you've done that, bundle install (without sudo) should work fine.
I develop a package called CodeRunner that has a number of add-on package (CodeRunner modules, all with names like ...crmod). One of these is called trinitycrmod.
On Debian stable (wheezy), I have installed RVM using the standard instructions. My .bashrc is setup correctly: the final line is:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
I am using Ruby 2.1.0 (but this error can be reproduced with 1.9.3)
rvm use 2.1
I have installed CodeRunner and trinitycrmod:
gem install coderunner
gem install trinitycrmod
Now the CodeRunner gem contains the tool coderunner. One of coderunner's commands is called ex, and it evaluates the ruby fragment you give the command. I want to load trinitycrmod.
coderunner ex ' require "trinitycrmod"'
But I get an error when loading the file (which is part of the installed gem).
.rvm/gems/ruby-2.1.0/gems/coderunner-0.13.32/lib/coderunner.rb:118:in `require': cannot load such file -- trinitycrmod (LoadError)
I don't get this error if I use ruby directly....
ruby `which coderunner` ex ' require "trinitycrmod"'
runs fine. I also don't get this error if I use the system ruby:
rvm use system
coderunner ex ' require "trinitycrmod"'
I also don't get this error if I edit the coderunner bin file and replace ruby_executable_hooks with plain ruby:
sed -i s/ruby_executable_hooks/ruby/ `which coderunner`
This makes me think that it has to be an error with ruby gems and/or rvm and not my mistake, particularly as this code is all at least 6 months old and has worked fine up till now.
PS My gem environment seems to be just fine....
RUBYGEMS VERSION: 2.2.1
RUBY VERSION: 2.1.0 (2013-12-25 patchlevel 0) [x86_64-linux]
INSTALLATION DIRECTORY: /home/edmundhighcock/.rvm/gems/ruby-2.1.0
RUBY EXECUTABLE: /home/edmundhighcock/.rvm/rubies/ruby-2.1.0/bin/ruby
EXECUTABLE DIRECTORY: /home/edmundhighcock/.rvm/gems/ruby-2.1.0/bin
SPEC CACHE DIRECTORY: /home/edmundhighcock/.gem/specs
RUBYGEMS PLATFORMS:
ruby
x86_64-linux
GEM PATHS:
/home/edmundhighcock/.rvm/gems/ruby-2.1.0
/home/edmundhighcock/.rvm/gems/ruby-2.1.0#global
GEM CONFIGURATION:
:update_sources => true
:verbose => true
:backtrace => false
:bulk_threshold => 1000
REMOTE SOURCES:
https://rubygems.org/
SHELL PATH:
/home/edmundhighcock/.rvm/gems/ruby-2.1.0/bin
/home/edmundhighcock/.rvm/gems/ruby-2.1.0#global/bin
/home/edmundhighcock/.rvm/rubies/ruby-2.1.0/bin
/home/edmundhighcock/.rvm/bin
/home/edmundhighcock/Code/scripts
/usr/local/bin
/usr/bin
/bin
/usr/local/games
/usr/games
the error message simply states that trinitycrmod gem is not installed correctly,
run gem list command and check whether the trinitycrmod gem is installed or not in your current gemset?
I've decided to move away from rvm to rbenv on my personal machine. Followed the rvm removal instructions, installed rbenv and everything looks peachy. After restarting my shell session:
$ rbenv global
1.9.3-p0
$ ls .rvm
ls: cannot access .rvm: No such file or directory
$ rbenv exec gem list
*** LOCAL GEMS ***
A completely fresh install in a fresh shell--RVM's long gone. Now, when I install bundler
$ rbenv exec gem install bundler
Fetching: bundler-1.0.22.gem (100%)
Successfully installed bundler-1.0.22
1 gem installed
$ rbenv rehash
$ echo $?
0
$ rbenv which bundle
rbenv: bundle: command not found
What? Indeed, look at this nonsense:
$ ls .rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.22/
bin bundler.gemspec CHANGELOG.md ISSUES.md lib LICENSE man Rakefile README.md spec UPGRADING.md
Somehow, someway, RVM still has its hooks into me. My ~/.bash* files are clean and
$ cat ~/.gemrc
gem: --no-ri --no-rdoc
I have no system ruby, no globally installed RVM (nothing in /etc/profile/, no /etc/profile.d/rvm.sh and nothing in /etc/bash.bashrc) and I'm at a complete loss.
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.11
- RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [i686-linux]
- INSTALLATION DIRECTORY: /home/blt/.rvm/gems/ruby-1.9.3-p0
- RUBY EXECUTABLE: /home/blt/.rbenv/versions/1.9.3-p0/bin/ruby
- EXECUTABLE DIRECTORY: /home/blt/.rvm/gems/ruby-1.9.3-p0/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /home/blt/.rvm/gems/ruby-1.9.3-p0
- /home/blt/.rvm/gems/ruby-1.9.3-p0#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- http://rubygems.org/
Where else can I look to figure out why gem's configured to install to ~/.rvm?
Something's clearly rotten on my system; no grepping has turned it up, but tacking
unset GEM_HOME
unset GEM_PATH
to the end of my ~/.bashrc made things sane. Horrible hack, though.
Have you ever installed rvm in a system location? Maybe those env vars got into a system-wide shell config.
Try running:
bash -l -x -c 'echo'
This will print bash debugging output so you can see what files are being loaded. It may not show commands inside sourced scripts, depending on your version of bash.
This probably doesn't apply to you, but if it exists, what are the contents of ~/.gemrc ?
I'm on Ubuntu 11.04 with ruby 1.9.2p180 installed from source using rvm. When I install a gem that makes a command-line binary, links are not made. For example, when I install the passenger gem, /var/lib/gems/1.9.2/bin/passenger is installed as expected and works, but a symbolic link is not made from /usr/bin/passenger as expected.
update
actually I have the same problem with vendor ruby and gem (on a different 11.04 server that has never had rvm).
$ sudo gem install bundler
$ bundle
bash: bundle: command not found
$ type bundle
-bash: type: bundle: not found
$ ls -lF /var/lib/gems/1.8/bin/bundle
-rwxr-xr-x 1 root root 383 2011-08-13 19:49 /var/lib/gems/1.8/bin/bundle*
RVM installation should be self-contained, which means it won't create symlinks out of the RVM directory. That should not be problem, though, as passenger binary should be added to path automatically by RVM.
Basically it should work like this:
$ rvm use ruby-1.9.2-p290
$ which gem
~/.rvm/rubies/ruby-1.9.2-p290/bin/gem
$ gem install passenger
$ which passenger
~/.rvm/gems/ruby-1.9.2-p290/bin/passenger
I would guess that you are using ubuntu's version of gem and ruby. rvm use ruby-1.9.2-p290 --default should fix that.
If rvm function is not accessible, add this to your .bash_profile:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
See https://rvm.beginrescueend.com/rvm/install/ for details.
I guess this can be your problem: installing rvm gems with sudo. Given you have the right privileges in your machine, this is not needed. But if you really need this, do rvmsudo gem install bundler instead.