我已经运行了将近一年的 oh-my-zsh 安装刚刚坏了。当我打开终端时,我得到:
/home/marcel/.oh-my-zsh/lib/theme-and-appearance.zsh:2: colors: function definition file not found
/home/marcel/.oh-my-zsh/oh-my-zsh.sh:78: compinit: function definition file not found
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:80: command not found: compdef
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:93: command not found: compdef
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:100: command not found: compdef
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:109: command not found: compdef
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:119: command not found: compdef
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:129: command not found: compdef
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:138: command not found: compdef
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:144: command not found: compdef
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:147: command not found: compdef
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:150: command not found: compdef
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:153: command not found: compdef
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:163: command not found: compdef
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:166: command not found: compdef
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:168: command not found: compdef
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:182: command not found: compdef
/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:193: command not found: compdef
$SPACESHIP_PROMPT_TRUNC is deprecated. Use $SPACESHIP_DIR_TRUNC instead.
spaceship_setup:3: add-zsh-hook: function definition file not found
spaceship_setup:4: add-zsh-hook: function definition file not found
$SPACESHIP_PROMPT_TRUNC is deprecated. Use $SPACESHIP_DIR_TRUNC instead.
spaceship_setup:3: add-zsh-hook: function definition file not found
spaceship_setup:4: add-zsh-hook: function definition file not found
Run Code Online (Sandbox Code Playgroud)
我环顾四周,很多其他答案都建议跑步compaudit。运行这给了我zsh: compaudit: function definition file not found。
rm ~/.zcompdump*/usr/share/zsh/functions到$fpathchown -R 755 /usr/share/zsh/functionscompaudit内部加载和运行zsh -funame -a: Linux Hermes 4.11.6-1-ARCH #1 SMP PREEMPT Sat Jun 17 08:19:42 CEST 2017 x86_64 GNU/Linuxzsh --version: zsh 5.3.1 (x86_64-unknown-linux-gnu)which zsh: /usr/local/bin/zsh我已经确认这是一个权限问题。如果我做
sudo zsh -f
autoload -U compaudit
compaudit
Run Code Online (Sandbox Code Playgroud)
该命令按预期工作。然后我做了
sudo chmod 777 /usr/share/zsh/ -R # Just for testing I promise
Run Code Online (Sandbox Code Playgroud)
我zsh: compaudit: function definition file not found在跑步时仍然得到了compaudit。
我也试过
sudo chown user:users /usr/share/zsh/ -R
Run Code Online (Sandbox Code Playgroud)
它仍然无法正常工作。如果所有这些文件都归我的用户所有并且是 777 zsh 如何以 root 而不是我的用户身份工作?
根据颜色、compinit 和 git 插件 #4757 安装问题中的线索,似乎验证“ $FPATH 变量内容”包含安装函数的位置的正确路径应该有助于解决问题。
此外,将 zsh 内容复制到某个位置(例如根或已定义的路径)$FPath也可能有助于解决此问题。
首先要做的是验证您的 FPATH 变量内容:echo $FPATH。在正常情况下返回类似的东西:
/home/charmander/.oh-my-zsh/plugins/git:/home/charmander/.oh-my-zsh/functions:/home/charmander/.oh-my-zsh/completions:/home/charmander/.oh-my-zsh/plugins/python:/home/charmander/.oh-my-zsh/plugins/pip:/home/charmander/.oh-my-zsh/plugins/git:/home/charmander/.oh-my-zsh/functions:/home/charmander/.oh-my-zsh/completions:/usr/share/zsh/site-functions:/usr/share/zsh/5.0.2/functions。就我而言,它返回:
/opt/intel/composer_xe_2011_sp1.7.256/mkl/include. 当我尝试删除·OH-MY-的zsh和运行的zsh只返回此:/usr/share/zsh/5.0.2/scripts/newuser:6: zsh-newuser-install: function definition file not found。在网上搜索我发现了这个错误报告: zsh:许多函数定义缺少 zsh-newuser-install、compinit 等,它们说它可能具有由英特尔编译器进行的变量覆盖:/因此,如果您无法运行此命令 chsh -s $(which zsh),则此问题的解决方法可能是将以下几行插入到您的 .bash_profile 中。
Run Code Online (Sandbox Code Playgroud)FPATH=/home/modelagem/beatriz.fonseca/.oh-my-zsh/plugins/python:/home/modelagem/beatriz.fonseca/.oh-my-zsh/plugins/pip:/home/modelagem/beatriz.fonseca/.oh-my-zsh/plugins/git:/home/modelagem/beatriz.fonseca/.oh-my-zsh/functions:/home/modelagem/beatriz.fonseca/.oh-my-zsh/completions:/usr/share/zsh/site-functions:/usr/share/zsh/5.0.2/functions export FPATH
此外,根据来自colors: function definition file not found #4607的线索,似乎其他人已经通过添加解决此问题来解决此问题,$HOME/usr/share/zsh/'version of zsh'/functions因为安装 zsh$HOME/usr可能会导致此问题。
Run Code Online (Sandbox Code Playgroud)FPATH The search path for function definitions. The directories in this path are searched for a file with the same name as the function or command when a function with the -u attribute is referenced and when a command is not found. If an executable file with the name of that command is found, then it is read and executed in the current environ-ment. environment. ment. Unlike PATH, the current directory must be represented explicitly by . rather than by adjacent : characters or a beginning or ending :.
9.1 自动加载功能
可以使用内置自动加载(或“functions -u”或“typeset -fu”)将函数标记为未定义。这样的函数没有主体。当函数第一次执行时,shell 使用 fpath 变量的元素搜索它的定义。
| 归档时间: |
|
| 查看次数: |
8223 次 |
| 最近记录: |