visual-studio-code - VSCode 提示解决我的环境需要太长时间

标签 visual-studio-code

当我从 Dock 启动 VSCode 时,它​​总是提示

Resolving your shell environment is taking very long. Please
review your shell configuration.


然后稍后

Unable to resolve your shell environment in a reasonable time.
Please review your shell configuration.


根据这个页面 Resolving Shell Environment is Slow ,如果 .bashrc 超过三秒,则显示第一条消息,如果超过十秒,则显示第二条消息。
我在 VSCode 中打开了一个终端并获取了我的 .bashrc 文件
dpatterson@dpconsulting$ time source ~/.bashrc
real    0m1.448s
user    0m0.524s
sys     0m0.671s

dpatterson@dpconsulting$ 
如您所见,只需不到 1.5 秒。
环境:
  • MacOS Mojave 10.14.6
  • VSCode 1.53.0

  • 希望有人知道是什么导致了这种情况。
    除此之外,也许有人可以将我指向实际生成这些错误的代码。
    TIA

    最佳答案

    遇到同样的情况,找到问题:
    https://github.com/microsoft/vscode/issues/113869#issuecomment-780072904
    我将 nvm load code 提取到 issue 中的 condition function ref,解决了这个问题:

    function load-nvm {
      export NVM_DIR="$HOME/.nvm"
      [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
      [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
      [[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh
    }
    
    # nvm
    if [[ "x${TERM_PROGRAM}" = "xvscode" ]]; then 
      echo 'in vscode, nvm not work; use `load-nvm`';
    else 
      load-nvm
    fi
    
    

    关于visual-studio-code - VSCode 提示解决我的环境需要太长时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66162058/

    相关文章:

    visual-studio-code - 停用 VSCode 中特殊字符的突出显示

    visual-studio-code - VS Code 滚动 map (小 map )

    visual-studio-code - 如何在按 Shift + * 时在 VSCodeVim 中设置搜索词突出显示

    git - 如何在 Visual Studio Code 中查看 Git 历史记录?

    git - Git从终端而不是从VS Code提交正确的用户

    java - Visual Studio Code 运行时检索 UnsupportedClassVersion 错误

    syntax-highlighting - 如何为 VS Code 创建简单的自定义语言着色

    git - Visual Studio Code : automatic commit git

    visual-studio-code - Visual Studio Code 集成终端中的 SIGINT

    visual-studio-code - 通过导航选项卡打开文件时,如何在 VSCode Explorer 面板中禁用文件自动对焦?