VSCode 找不到构建任务命令

VSCode build task command not found

我在 vscode 工作,我想在 tasks.json 构建 chromium,但是构建 shell 报告错误 command not found。我使用 echo $PATH 查看 tasks.json 中的环境变量。 vscode中的构建shell似乎没有执行source ~/.bashrc,所以它找不到环境变量,但vscode中的终端可以正常工作。有人可以帮助我吗?

在settings.json

中添加“terminal.integrated.shell.linux”:“/bin/bash”

我遇到了同样的问题并使用以下解决方案修复了它

ZSH OSX 的解决方案

/usr/local/bin/zsh-with-rc下添加一个新文件

#!/usr/bin/env zsh

source ~/.zshrc

/bin/zsh $@

然后运行

chmod +x /usr/local/bin/zsh-with-rc

settings.json中添加:

"terminal.integrated.automationProfile.osx": {
        "path": "/usr/local/bin/zsh-with-rc",
}

Linux Bash

的解决方案

/usr/local/bin/bash-with-profile下添加一个新文件

#!/usr/bin/env bash

source ~/.bash_profile
source ~/.bashrc

/bin/bash $@

然后运行

chmod +x /usr/local/bin/bash-with-profile

settings.json中添加:

"terminal.integrated.automationProfile.linux": {
        "path": "/usr/local/bin/bash-with-profile",
}