问题描述
VSCode启动提示:无法在合理的时间内解析shell
原因分析
nvm如果在shell初始化期间运行,会导致shell启动时间变慢
解决方法
- 修改文件
~/.bash_profile
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
}
# nvm
if [[ "x${TERM_PROGRAM}" = "xvscode" ]]; then
echo 'in vscode, nvm not work; use `load-nvm`';
else
load-nvm
fi
- 执行
source ~/.bash_profile
source ~/.zshrc
,重启VSCode