简体   繁体   English

安装Ruby 2.1.1时遇到问题

[英]Having trouble installing Ruby 2.1.1

I am trying to update my Ruby version with my rbenv and am having trouble installing 2.1.1. 我正在尝试使用rbenv更新我的Ruby版本,并且在安装2.1.1时遇到问题。 I have followed the instructions carefully but it does not seem to be working for some reason. 我已经仔细按照说明进行操作,但是由于某种原因,它似乎没有起作用。 Please let me know what I am doing wrong. 请让我知道我在做什么错。

Installed ruby-2.1.1 to /Users/user/.rbenv/versions/2.1.1  
$ 
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ rbenv rehash
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ rbenv global 2.1.1
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ rbenv global 2.1.1
$ rbenv rehash
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ rbenv local 2.1.1
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ rbenv versions
system
* 2.1.1 (set by /Users/user/.ruby-version)
$ rbenv global 2.1.1
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ 

Any thoughts on what's going on? 有什么想法吗?

not sure if this helps get to the root of the issue.. 不知道这是否有助于找到问题的根源。

PATH=usr/local/bin:/urs/local/sbin:/usr/local/mysql/bin:usr/local/bin:/urs/local/sbin:/usr/loca        /mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
\$ ~/.bash_profile
-bash: /Users/user/.bash_profile: Permission denied
$ ~/.bash_profile
-bash: /Users/user/.bash_profile: Permission denied
$ export PATH="$HOME./rbenv/bin:$PATH"
$ "$(rbenv init -)"
-bash: export PATH="/Users/user/.rbenv/shims:${PATH}"
source "/usr/local/Cellar/rbenv/0.4.0/libexec/../completions/rbenv.bash"
rbenv rehash 2>/dev/null
rbenv() {
typeset command
command="$1"
if [ "$#" -gt 0 ]; then
shift
fi

case "$command" in
rehash|shell)
eval `rbenv "sh-$command" "$@"`;;
*)
command rbenv "$command" "$@";;
esac
}: No such file or directory

Sigh... first, take a close look at your path: 叹气...首先,仔细看看您的路径:

PATH=usr/local/bin:/urs/local/sbin:/usr/local/mysql/bin:usr/local/bin:/urs/local/sbin:/usr/loca        /mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

You have multiple definitions for the same directories, and, in addition have what are very likely invalid directory names: 您对同一目录有多个定义,此外,还有很可能是无效目录名的内容:

  • usr/local/bin should be /usr/local/bin . usr/local/bin应该是/usr/local/bin usr/local/bin is a relative directory name, which would usually be invalid anywhere unless you're in your / directory. usr/local/bin是相对目录名称,通常除非在/目录中,否则在任何地方都无效。 This is in the path multiple times, so remove all but the middle one and fix the name. 该路径多次出现,因此请除去中间的所有路径并固定名称。
  • /urs/local/sbin is probably a misspelled directory /usr/local/sbin , but, at the same time, you probably shouldn't have a .../sbin directory in your path because you'll seldom use the files in there. /urs/local/sbin可能是拼写错误的目录/usr/local/sbin ,但是同时,您的路径中可能不应该有.../sbin目录,因为您很少使用那里。 That particular directory is in your path twice, so remove at least one. 该特定目录在您的路径中有两次,因此请至少删除一个。
  • /usr/loca /mysql/bin is totally invalid so remove it. /usr/loca /mysql/bin完全无效,因此将其删除。 If you are using MySQL, then fix that entry; 如果您使用的是MySQL,则修复该条目; It's probably /usr/local/share/mysql/bin , but confirm that and adjust as necessary. 它可能是/usr/local/share/mysql/bin ,但请确认并根据需要进行调整。

You're using 您正在使用

export PATH="$HOME./rbenv/bin:$PATH"

which is not a valid definition for PATH. 这不是PATH的有效定义。 $HOME would normally look like /home/user , without a terminating or delimiting / . $HOME通常看起来像/home/user ,没有终止或定界/ Using $HOME./rbenv... would result in /home/user./rbenv... which isn't valid. 使用$HOME./rbenv...将导致/home/user./rbenv...无效。

rbenv needs a chance to initialize when your shell session starts. rbenv需要机会在您的Shell会话启动时进行初始化。 To do that it expects you to add 为此,希望您添加

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

to your ~/.bash_profile file as the very last lines. 最后一行添加到〜/ .bash_profile文件。 It's obvious that hasn't been done because your path would reflect that if it had. 显然,这还没有完成,因为您的路径会反映出这一点。 Mine starts with a reference to rbenv's shim, then bin directories. 我的游戏首先引用了rbenv的填充程序,然后是bin目录。

I have followed the instructions carefully but it does not seem to be working for some reason. 我已经仔细按照说明进行操作,但是由于某种原因,它似乎没有起作用。

I'd strongly recommend you read the rbenv documentation for setting it up. 强烈建议您阅读rbenv文档进行设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM