Alan Coromano
Alan Coromano

Reputation: 26008

How do I fix rvmrc file?

I set up rvm (and .rvmrc file) not properly, therefore whenever I go the directory of my RoR project and type rails s or any other rails command, I'll get the error of

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

and I have to type rvm use 1.9.3-p392 to fix it.

.rvmrc file contains

environment_id="ruby-1.9.3-p392@project1"
if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
  && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
then
  \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
  for __hook in "${rvm_path:-$HOME/.rvm}/hooks/after_use"*
  do
    if [[ -f "${__hook}" && -x "${__hook}" && -s "${__hook}" ]]
    then \. "${__hook}" || true
    fi
  done
  unset __hook
else
  # If the environment file has not yet been created, use the RVM CLI to select.
  rvm --create  "$environment_id" || {
    echo "Failed to create RVM environment '${environment_id}'."
    return 1
  }
fi

Upvotes: 0

Views: 354

Answers (3)

Paulo Fidalgo
Paulo Fidalgo

Reputation: 22296

Post your rvmrc file in order to get some help. If you want to check a look at other's project rvmrc file you can take a look at octopress here. Also you can take a look at rvmrc docs if you haven't already looked.

The message you've got is from the autocomplete ubuntu/debian projects, meaning that it can't found the rails command, so it suggests the packages you can install to get it. Probably you havent loaded the rvm environment. You can load it via:

source $HOME/.rvm/scripts/rvm

and then check if it works.

Upvotes: 1

lis2
lis2

Reputation: 4264

.rvmrc in the newest version of RVM is deprecated. It should work but try new syntax:

put to .ruby-version file just:

1.9.3-p392

Additionaly you can define .ruby-gemset with

yourgemsetname

Upvotes: 1

deepthi
deepthi

Reputation: 685

Try rvm use ruby-1.9.3-p391 --default

Upvotes: 1

Related Questions