문제

Working in Nitrous.IO, my rails app was acting strange. So I checked and I was using rails version 0.9.5 instead of version 4.0.1! I decided to do a gem uninstall rails --version 0.9.5. Everything is good, except it also removed the rails executable! How do I get that back? Seems like version 4.0.1 is there, but I can't run the rails command. Should I just uninstall and reinstall rails?

UPDATE: Tried gem install rails even though I already had rails 4.0.1 installed:

action@creativebox-45198:~$ gem install rails                                                                                                                                      
Successfully installed rails-4.0.1                                                                                                                                                 
1 gem installed                                                                                                                                                                    
action@creativebox-45198:~$ rails -v                                                                                                                                               
-bash: rails: command not found
도움이 되었습니까?

해결책

This issue has been resolved through Nitrous support channels. Somehow the file /home/action/.rvm/gems/ruby-2.0.0-p247/bin/rails was missing, and gem install rails did not add it. Manually adding this file with the following contents solved the issue.

#!/usr/bin/env ruby_noexec_wrapper
#
# This file was generated by RubyGems.
#
# The application 'railties' 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/
    version = $1
    ARGV.shift
  end
end

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

다른 팁

Should be fine running gem install rails.

Try hash rails if you're using Bash, or rehash rails for csh, at the command-line.

Sometimes the shell loses track of where files are and (re)hash tells the shell to figure it out.

Do a search for hash + shell or use man hash for more information.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top