【问题标题】:rbenv doesn't get correct version in tmuxrbenv 在 tmux 中没有得到正确的版本
【发布时间】:2020-05-22 03:36:16
【问题描述】:

当我在带有文件.ruby-version 的项目文件夹中时,rbenv version 从项目.ruby-version 返回正确的 ruby​​ 版本,但是当我进入 tmux 时,它总是返回全局 ruby​​ 版本。

当我在没有 tmux 的情况下运行 RBENV_DEBUG=1 rbenv version 时,它找到了正确的本地路径,它是项目路径。

+ [rbenv-version-file:22] '[' -n '' ']'
+ [rbenv-version-file:25] find_local_version_file /Users/user_name/project_folder
+ [rbenv-version-file:10] local root=/Users/user_name/project_folder
+ [rbenv-version-file:11] [[ /Users/user_name/project_folder =~ ^//[^/]*$ ]]
+ [rbenv-version-file:12] '[' -s /Users/user_name/project_folder/.ruby-version ']'
+ [rbenv-version-file:13] echo /Users/user_name/project_folder/.ruby-version
+ [rbenv-version-file:14] return 0
+ [rbenv-version:11] echo '2.5.7 (set by /Users/user_name/project_folder/.ruby-version)'

但是在 tmux 中,它得到了错误的本地路径,它是主路径。

+ [rbenv-version-file:7] target_dir=
+ [rbenv-version-file:22] '[' -n '' ']'
+ [rbenv-version-file:25] find_local_version_file /Users/user_name
+ [rbenv-version-file:10] local root=/Users/user_name
+ [rbenv-version-file:11] [[ /Users/user_name =~ ^//[^/]*$ ]]
+ [rbenv-version-file:12] '[' -s /Users/user_name/.ruby-version ']'
+ [rbenv-version-file:13] echo /Users/user_name/.ruby-version
+ [rbenv-version-file:14] return 0
+ [rbenv-version:11] echo '2.5.1 (set by /Users/user_name/.ruby-version)'

在升级 Catalina 之前它可以工作,升级 Catalina 后它会中断, 所以我认为这很重要,但我不知道如何找到,任何帮助将不胜感激。

【问题讨论】:

  • 如果它不能与 tmux 一起使用,很有可能您的环境没有正确获取资源。
  • @theTinMan 是的,我知道应该有问题,但是在升级 Catalina 之前它已经工作了,我曾经注释掉所有 tmux.conf 设置,它没有帮助。
  • 你现在可能使用的是zsh而不是bash,它使用不同的配置文件(.zprofile而不是.bash_profile.zshrc而不是.bashrc)。

标签: ruby tmux macos-catalina rbenv


【解决方案1】:

仅适用于使用 rbenv 路径的本地 ruby​​ 版本。如果您的捆绑软件之前已使用不受 rbenv 管理的 ruby​​ 版本安装,那么您对 ​​tmux 的情况与捆绑软件相同。 假设一个 linux 终端:在你的 tmux 中,附加你的 linux 终端并然后根据它的official github repository 安装 rbenv。 如果您的 rbenv 是在您已经安装了 ruby​​ 版本之后安装的,tmux 可能会继续搜索全局 ruby​​ 版本。

【讨论】:

    猜你喜欢
    • 2019-05-19
    • 2012-05-14
    • 2018-07-11
    • 2023-03-11
    • 2013-04-25
    • 1970-01-01
    • 2018-04-16
    • 2021-06-19
    • 2010-09-15
    相关资源
    最近更新 更多