微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby-on-rails – Railties的可执行文件“rails”与/usr/bin/rails冲突

我试图安装rails使用命令sudo gem安装rails但是,当我这样做,我得到以下错误消息:
railties's executable "rails" conflicts with /usr/bin/rails
 Overwrite the executable? [yN]

我目前没有安装导轨,我不想安装RVM或rbenv,尽管我稍后可能会这样做.

注: Rails当前未安装

有人建议我应该做什么?

谢谢

解决方法

刚刚在我的MacBook上安装Rails时遇到了这个问题.我打开了/usr/bin /目录,并在文本编辑器中打开了“rails”文件.这是结果.
#!/usr/bin/ruby
# Stub rails command to load rails from Gems or print an error if not installed.
require 'rubygems'

version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
  version = $1
  ARGV.shift
end

begin
  gem 'railties',version or raise
rescue Exception
  puts 'Rails is not currently installed on this system. To get the latest version,simply type:'
  puts
  puts '    $sudo gem install rails'
  puts
  puts 'You can then rerun your "rails" command.'
  exit 0
end

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

我认为让gem安装程序重写这个存根是安全的,但现在它更多的是个人喜好.我尽可能避免修改任何“核心”文件.

经过快速的Google搜索,我遇到了这篇有希望的文章,并将其用于我的安装.
Ruby on Rails development setup for Mac OSX

干杯!

原文地址:https://www.jb51.cc/ruby/266223.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐