首页 > 解决方案 > 我在我的电脑上安装了fish shell,现在我无法打开VS code终端

问题描述

我在我的电脑上安装了fish shell,现在我无法打开VS code终端。

当我尝试在 VS 代码上打开终端时,出现以下错误:“终端进程无法启动:shell 可执行文件“/usr/bin/fish”的路径不存在。”

从外部 VS 代码打开终端没有问题。当我在其上输入 echo "$SHELL" 命令时,我得到/usr/bin/fish这正是 VS 代码无法找到的路径。

我该如何解决这个问题?我正在使用ubuntu。

标签: shellvisual-studio-codeterminalvscode-settingsfish

解决方案


我有同样的问题。问题是 VSC 默认只在 /usr/bin 中查找 shell。我复制了默认终端设置并更新fishbrew安装位置:/usr/local/bin

"terminal.integrated.profiles.osx": {
    "bash": {
        "path": "bash",
        "args": [
            "-l"
        ],
        "icon": "terminal-bash"
    },
    "zsh": {
        "path": "zsh",
        "args": [
            "-l"
        ]
    },
    "fish": {
        "path": "/usr/local/bin/fish", // overriding
        "args": [
            "-l"
        ]
    }
},

这对于其他操作系统应该是相同的,你只需要 linux 或 windows 而不是 osx。

在 VS Code 终端中运行的鱼

要获得该设置,请打开您的设置(mac 上的 cmd 逗号或其他地方的 ctrl 逗号),搜索终端配置文件: 设置搜索 然后单击 settings.json 中的编辑。它应该带您到正确的位置粘贴这些配置文件。


推荐阅读