The terminal process failed to launch: Path to shell executable "cargo" does not exist解决方案

  1. 配置:WSL+vscode+ubuntu24

  2. 问题:在vscode使用rust-analyzer点击RunThe terminal process failed to launch: Path to shell executable "cargo" does not exist

  3. 解决方案

    1. 在环境变量中加入cargo/bin

      $ vim ~/.bashrc
      export PATH="$HOME/.cargo/bin:$PATH"
      $ source ~/.bashrc
      
    2. 在rust-analyzer的settings.json加入路径

          "git.openRepositoryInParentFolders": "never",
          "files.autoSave": "afterDelay",
          "workbench.startupEditor": "none",
          "rust-analyzer.linkedProjects": [
          
          ],
          "rust-analyzer.cargo.cargoBinPath": "/home/username/.cargo/bin/cargo", # change your path
          "rust-analyzer.rustc.path": "/home/username/.cargo/bin/rustc" # change your path
      }
      
    3. 重启

posted @ 2026-01-25 15:09  起早贪黑送外卖  阅读(2)  评论(0)    收藏  举报