Search code examples
visual-studio-codebuildchromium

VSCode build task command not found


I'm working in vscode, and I want to build the chromium in tasks.json, but the build shell report error command not found. I use echo $PATH to see the environments variables in tasks.json. It seems like the build shell in vscode doesn't execute source ~/.bashrc, so it can't find environment variable, but the terminal in vscode is in working order. Could someone help me?


Solution

  • I had the same issue and fixed it with the solution below

    Solution For OSX with ZSH

    Add a new file under /usr/local/bin/zsh-with-rc

    #!/usr/bin/env zsh
    
    source ~/.zshrc
    
    /bin/zsh $@
    

    Then run

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

    In settings.json add:

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

    Solution For Linux With Bash

    Add a new file under /usr/local/bin/bash-with-profile

    #!/usr/bin/env bash
    
    source ~/.bash_profile
    source ~/.bashrc
    
    /bin/bash $@
    

    Then run

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

    In settings.json add:

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