0

I'm attempting to create a new rails app but when I type the command

rails new test-app

I receive the following "LoadError" message:

/home/andrew/.rvm/gems/ruby-2.1.5/bin/rails:23:in `load': cannot load such file -- /home/andrew/.rvm/gems/ruby-2.1.5/gems/rails-4.2.0/bin/rails (LoadError)
from /home/andrew/.rvm/gems/ruby-2.1.5/bin/rails:23:in `<main>'
from /home/andrew/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
from /home/andrew/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'

Here is the rails file in /home/andrew/.rvm/gems/ruby-2.1.5/bin/:

#!/usr/bin/env ruby_executable_hooks
#
# This file was generated by RubyGems.
#
# The application 'rails' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0"

if ARGV.first
  str = ARGV.first
  str = str.dup.force_encoding("BINARY") if str.respond_to?:force_encoding
  if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
    version = $1
    ARGV.shift
  end
end

gem 'rails', version
load Gem.bin_path('rails', 'rails', version)

And here is my ruby_executable_hooks file in the same directory:

#!/usr/bin/env ruby

title = "ruby #{ARGV*" "}"
$0    = ARGV.shift
Process.setproctitle(title) if Process.methods.include?(:setproctitle)

require 'rubygems'
begin
  require 'executable-hooks/hooks'
  Gem::ExecutableHooks.run($0)
rescue LoadError
  warn "unable to load executable-hooks/hooks" if ENV.key?('ExecutableHooks_DEBUG')
end

eval File.read($0), binding, $0

This question seems to be very similar to mine but I don't really understand the solution involving RVM setup files. When I explicitly tell rails to use an older version when creating a new app like so:

rails _3.1.0_ new test-app

This does work without issue, and it seems I can make a rails 4.2.0 app by editing my Gemfile after the app's initial creation. However I'd prefer a more permanent solution than this if possible.

Community
  • 1
  • 1

0 Answers0