安装 oh-my-zsh 后: ... /.zshrc:source:34: 没有这样的文件或目录 ... /.oh-my-zsh/oh-my-zsh.sh

安装 oh-my-zsh 后: ... /.zshrc:source:34: 没有这样的文件或目录 ... /.oh-my-zsh/oh-my-zsh.sh

我刚刚尝试安装哦我的zsh。当我尝试运行时出现以下错误rvm

zsh: command not found: rvm

当我尝试打开新选项卡时,我还收到以下错误:

/Users/jack/.zshrc:source:34: no such file or directory: /Users/jack/.oh-my-zsh/oh-my-zsh.sh
/Users/jack/.zshrc:source:38: no such file or directory: .bashrc

这是我的.zshrc文件:

# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"

# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"

# Comment this out to disable weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"

# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git bundler brew gem rvm cscairns)

source $ZSH/oh-my-zsh.sh

# Customize to your needs...

source .bashrc
export PATH=/usr/local/bin:$PATH

我需要做什么来修复这些错误?

答案1

安装zsh不会安装 Oh My Zsh,如果您oh-my-zsh.sh根本没有文件(我就是这种情况),这可能会解释。

您可以安装哦我的Zsh通过跑步

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

答案2

为了这:

/Users/jack/.zshrc:source:34: no such file or directory: /Users/jack/.oh-my-zsh/oh-my-zsh.sh

问题是这一行:

source $ZSH/oh-my-zsh.sh

您没有调用oh-my-zsh.sh的文件/Users/jack/.oh-my-zsh

为了这:

/Users/jack/.zshrc:source:38: no such file or directory: .bashrc

问题和上面一样;本质上,你没有.bashrc文件/Users/jack/

$ZSH指向的/Users/jack/.oh-my-zsh目录中似乎没有该名称的文件zsh.sh

就最初的问题(zsh: command not found: rvm)而言,问题在于该命令rvm不在您的任何位置,$PATH它显然指向/usr/local/bin加上无论系统范围的设置是什么。

我建议您使用find / -name "rvm"并查看文件系统中的rvm实际位置,然后更新 $PATH 变量,如下所示:export PATH=/path/to/rv/:$PATH

答案3

快速修复此问题

/Users/jack/.zshrc:source:34: no such file or directory: /Users/jack/.oh-my-zsh/oh-my-zsh.sh

使可执行,可执行。

cd .oh-my-zsh/ && chmod 744 oh-my-zsh.sh

然后运行exec zsh以重新启动 shell。如果您没有收到错误,并且您选择的主题正在运行,那么您就可以开始了。

答案4

我删除了位于的旧 .oh-my-zsh 文件,home/username/.oh-my-zsh 然后通过 runnung 再次安装它sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" ,问题得到了解决。

相关内容