安装oh-my-zsh之后:…/.zshrc:source:34:没有此类文件或目录…/.oh-my-zsh/oh-my-zsh.sh


12

我只是尝试安装oh-my-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

我需要怎么做才能解决这些错误?

Answers:


9

安装zsh不会安装“噢,我的Zsh”,这可能会解释您是否根本没有oh-my-zsh.sh文件(我就是这种情况)。

您可以运行以下命令安装Oh My Zsh

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

1
关于zsh的两个星期的问题到此结束。谢谢!
ZGski

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

你没有一个名为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/binplus,而不管系统范围的设置如何。

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


1

快速解决此问题

/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以重新启动您的外壳程序。如果您没有收到错误消息,并且您选择的主题正在运行,那很好。



0

~/.zshrc将以下行添加到文件中,以修复错误rvm

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

0

我有以下错误:

/Users/frankus/.zshrc:source:50: no such file or directory:  /Users/frankus/.oh-my-zsh^M/oh-my-zsh.sh

我通过重命名oh-my-zsh文件夹来修复它

mv ~/.oh-my-zsh^M ~/.oh-my-zsh

0

我也收到此错误,并且由于简单的错字而导致了该错误。

在您.zshrc设置主题名称的文件中,请勿包含引号。所以不要做

ZSH_THEME="robbyrussell"

您应该执行以下操作

ZSH_THEME=robbyrussell

这样可以解决您在进入新标签页时出现错误的问题。谢谢。


0

每当我打开新的终端窗口(iterm2)时,我都会遇到相同的问题:

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

运行后,source .zshrc一切都很好加载。

但是oh-my-zsh.sh我的~/.oh-my-zsh目录中确实有一个。

(它不需要用chmod +x或任何东西进行更改。)

我意识到我所缺少的只是ZSH=$HOME/.oh-my-zsh前一行

export ZSH="/Users/XXX/.oh-my-zsh" source $ZSH/oh-my-zsh.sh


0

对我来说,这个问题原来是.zshrc文件本身,因为我已经迁移到另一台计算机上,只是复制了完整的文件,而不是更改其值,ZSH而将其设置为ZSH=<old_machine_path>/.oh-my-zsh只是将其更改为较新的计算机路径即可。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.