安装 oh-my-zsh 后:... /.zshrc:source:34: no such file or directory ... /.oh-my-zsh/oh-my-zsh.sh

ker*_*lin 21 bash zsh oh-my-zsh

我只是尝试安装oh-my-zsh。尝试运行时出现以下错误rvm

zsh: command not found: rvm
Run Code Online (Sandbox Code Playgroud)

当我尝试打开一个新标签时,我也会收到以下错误:

/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
Run Code Online (Sandbox Code Playgroud)

这是我的.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
Run Code Online (Sandbox Code Playgroud)

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

小智 16

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

您可以通过运行安装Oh My Zsh

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

  • 两周的 zsh 问题以这一行结束。谢谢! (2认同)

小智 7

为了这:

/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
Run Code Online (Sandbox Code Playgroud)

你没有一个名为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