Why have Rails & Bundler package have dissapeared?

578 Views Asked by At

I'm following Michael Hartl's Ruby on Rails tutorial & everything has been working fine until I reached this stage.

For some reason when I try to run a bundler or the rails command it says they are not installed even though they were working before & I've tried to reinstall them.

Could this have something to do with my rvm gemset? I'm not sure how to check the rvmrc file.

Or could it be something to do with my OS. I'm working on ubuntu 12.10 on a virtual box hosted in windows 7.

Thanks in advance for your help.

If it helps here is the repo for the app.

Console Read Out

first_app: $ bundle install --without production
ERROR: Gem bundler is not installed, run `gem install bundler` first.

first_app: $ bundle update
ERROR: Gem bundler is not installed, run `gem install bundler` first.

first_app: $ gem install bundler
Successfully installed bundler-1.3.2
1 gem installed

first_app: $ bundle install --without production
ERROR: Gem bundler is not installed, run `gem install bundler` first.

first_app: $ ruby -v
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]


first_app: $ rails -v
The program 'rails' can be found in the following packages:
 * rails
 * ruby-railties-3.2
Try: sudo apt-get install <selected package>

first_app: $ gem install rails -v 3.2.12
Successfully installed rails-3.2.12
1 gem installed
    first_app: $ rails -v
The program 'rails' can be found in the following packages:
 * rails
 * ruby-railties-3.2
Try: sudo apt-get install <selected package>

first_app: $ sudo apt-get install rails -v 3.2.12
[sudo] password for ross: 
apt 0.9.7.5ubuntu5.1 for amd64 compiled on Dec 12 2012 13:50:19
Supported modules:
*Ver: Standard .deb
*Pkg:  Debian dpkg interface (Priority 30)
 Pkg:  Debian APT solver interface (Priority -1000)
 S.L: 'deb' Standard Debian binary tree
 S.L: 'deb-src' Standard Debian source tree
 Idx: Debian Source Index
 Idx: Debian Package Index
 Idx: Debian Translation Index
 Idx: Debian dpkg status file
 Idx: EDSP scenario file

first_app: $ rails -v
The program 'rails' can be found in the following packages:
 * rails
 * ruby-railties-3.2
Try: sudo apt-get install <selected package>
first_app: $ 

~: $ gem list bundler

*** LOCAL GEMS ***


~: $ rvm gemset list

gemsets for ruby-1.9.3-p392 (found in /home/ross/.rvm/gems/ruby-1.9.3-p392)
   (default)
   global
=> rails3tutorial2ndEd

~: $ which gem
/home/ross/.rvm/bin/gem

first_app: $ gem uninstall bundler && rvm @global do gem install bundler && bundle -v

You have requested to uninstall the gem:
    bundler-1.3.2
bundle-0.0.1 depends on [bundler (>= 0)]
multi_json-1.6.1 depends on [bundler (~> 1.0)]
rails-3.2.12 depends on [bundler (~> 1.0)]
uglifier-1.3.0 depends on [bundler (~> 1.0)]
uglifier-1.2.3 depends on [bundler (~> 1.0)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  y
Remove executables:
    bundle

in addition to the gem? [Yn]  y
Removing bundle
Successfully uninstalled bundler-1.3.2
Successfully installed bundler-1.3.2
1 gem installed
ERROR: Gem bundler is not installed, run `gem install bundler` first.

user/.rvm/bin/gem

#!/usr/bin/env bash

if [[ -s "/home/ross/.rvm/environments/ruby-1.9.3-p392@rails3tutorial2ndEd" ]]
then
  source "/home/ross/.rvm/environments/ruby-1.9.3-p392@rails3tutorial2ndEd"
  exec gem "$@"
else
  echo "ERROR: Missing RVM environment file: '/home/ross/.rvm/environments/ruby-1.9.3-p392@rails3tutorial2ndEd'" >&2
  exit 1
fi

/home/ross/.rvm/environments/ruby-1.9.3-p392@rails3tutorial2ndEd

export PATH ; PATH="/home/ross/.rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd/bin:/home/ross/.rvm/gems/ruby-1.9.3-p392@global/bin:/home/ross/.rvm/rubies/ruby-1.9.3-p392/bin:/home/ross/.rvm/bin:$PATH"
export rvm_env_string ; rvm_env_string='ruby-1.9.3-p392@rails3tutorial2ndEd'
export rvm_path ; rvm_path='/home/ross/.rvm'
export rvm_ruby_string ; rvm_ruby_string='ruby-1.9.3-p392'
export rvm_gemset_name ; rvm_gemset_name='rails3tutorial2ndEd'
export RUBY_VERSION ; RUBY_VERSION='ruby-1.9.3-p392'
export GEM_HOME ; GEM_HOME='/home/ross/.rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd'
export GEM_PATH ; GEM_PATH='/home/ross/.rvm/gems/ruby-1.9.3-p392@rails3tutorial2ndEd:/home/ross/.rvm/gems/ruby-1.9.3-p392@global'
export MY_RUBY_HOME ; MY_RUBY_HOME='/home/ross/.rvm/rubies/ruby-1.9.3-p392'
export IRBRC ; IRBRC='/home/ross/.rvm/rubies/ruby-1.9.3-p392/.irbrc'
unset MAGLEV_HOME
unset RBXOPT
2

There are 2 best solutions below

3
On BEST ANSWER

This issue was caused by a amendment I made to my ~/.bashrc file to customize the prompt in my terminal. I had put PS1='\[\033[01;31m\]\W: \[\033[01;33m\]\$ \[\033[01;37m\]' at the bottom of the ~/.bashrc file.

I had to remove PS1='\[\033[01;31m\]\W: \[\033[01;33m\]\$ \[\033[01;37m\]' & completely uninstall & remove RVM & Ruby from my system & reinstall them. I tried rvm implode to remove everything but this didn't work at first, it said rvm was not installed! When I tried source ~/.rvm/scripts/rvm, I was able to succesffully run rvm implode.

I was able to customize my prompt by putting:

PS1='\[\033[01;31m\]\W: \[\033[01;33m\]\$ \[\033[01;37m\]'

source ~/.rvm/scripts/rvm

into my ~/.bash_profile

1
On

It looks like you missed last step of rvm install section of the tutorial:

$ rvm use 1.9.3@rails3tutorial2ndEd --create --default
Using /Users/mhartl/.rvm/gems/ruby-1.9.3 with gemset rails3tutorial2ndEd