You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WSL Ubuntu 24.04下NvChad的Treesitter uv_dlopen无错误报错求助

NvChad + WSL Ubuntu 24.04 中 Treesitter 解析器加载失败(uv_dlopen: no error)

问题描述

原本手动配置Neovim耗时超出预期,转用NvChad。在WSL Ubuntu 24.04环境安装后,Treesitter出现异常:Neovim内置的c等解析器可正常使用,但通过:TSInstall安装的lua、luadoc、printf、vim、vimdoc、odin等解析器均无法加载,报错信息为uv_dlopen: no error。

已尝试的操作:

  • 执行:TSUpdate
  • 执行:TSUninstall all后重新安装解析器
  • 执行Lazy sync
  • 执行MasonInstallAll
  • 重新安装Neovim和NvChad
  • 仅修改了timeoutlen=50及双引号、加号寄存器修复规则,无其他复杂配置

:checkhealth的完整报错信息:

- ERROR lua(highlights): ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
  lua(highlights) is concatenated from the following files:
  | [ERROR]:"/home/pholub/.local/share/nvim/lazy/nvim-treesitter/queries/lua/highlights.scm", failed to load: ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
- ERROR lua(locals): ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
  lua(locals) is concatenated from the following files:
  | [ERROR]:"/home/pholub/.local/share/nvim/lazy/nvim-treesitter/queries/lua/locals.scm", failed to load: ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
- ERROR lua(folds): ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
  lua(folds) is concatenated from the following files:
  | [ERROR]:"/home/pholub/.local/share/nvim/lazy/nvim-treesitter/queries/lua/folds.scm", failed to load: ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
- ERROR lua(indents): ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
  lua(indents) is concatenated from the following files:
  | [ERROR]:"/home/pholub/.local/share/nvim/lazy/nvim-treesitter/queries/lua/indents.scm", failed to load: ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
- ERROR lua(injections): ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
  lua(injections) is concatenated from the following files:
  | [ERROR]:"/home/pholub/.local/share/nvim/lazy/nvim-treesitter/queries/lua/injections.scm", failed to load: ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'lua': uv_dlopen: no error
- ERROR luadoc(highlights): ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'luadoc': uv_dlopen: no error
  luadoc(highlights) is concatenated from the following files:
  | [ERROR]:"/home/pholub/.local/share/nvim/lazy/nvim-treesitter/queries/luadoc/highlights.scm", failed to load: ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'luadoc': uv_dlopen: no error
- ERROR printf(highlights): ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'printf': uv_dlopen: no error
  printf(highlights) is concatenated from the following files:
  | [ERROR]:"/home/pholub/.local/share/nvim/lazy/nvim-treesitter/queries/printf/highlights.scm", failed to load: ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'printf': uv_dlopen: no error
- ERROR vim(highlights): ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'vim': uv_dlopen: no error
  vim(highlights) is concatenated from the following files:
  | [ERROR]:"/home/pholub/.local/share/nvim/lazy/nvim-treesitter/queries/vim/highlights.scm", failed to load: ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'vim': uv_dlopen: no error
- ERROR vim(locals): ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'vim': uv_dlopen: no error
  vim(locals) is concatenated from the following files:
  | [ERROR]:"/home/pholub/.local/share/nvim/lazy/nvim-treesitter/queries/vim/locals.scm", failed to load: ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'vim': uv_dlopen: no error
- ERROR vim(folds): ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'vim': uv_dlopen: no error
  vim(folds) is concatenated from the following files:
  | [ERROR]:"/home/pholub/.local/share/nvim/lazy/nvim-treesitter/queries/vim/folds.scm", failed to load: ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'vim': uv_dlopen: no error
- ERROR vim(injections): ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'vim': uv_dlopen: no error
  vim(injections) is concatenated from the following files:
  | [ERROR]:"/home/pholub/.local/share/nvim/lazy/nvim-treesitter/queries/vim/injections.scm", failed to load: ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'vim': uv_dlopen: no error
- ERROR vimdoc(highlights): ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'vimdoc': uv_dlopen: no error
  vimdoc(highlights) is concatenated from the following files:
  | [ERROR]:"/home/pholub/.local/share/nvim/lazy/nvim-treesitter/queries/vimdoc/highlights.scm", failed to load: ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'vimdoc': uv_dlopen: no error
- ERROR vimdoc(injections): ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'vimdoc': uv_dlopen: no error
  vimdoc(injections) is concatenated from the following files:
  | [ERROR]:"/home/pholub/.local/share/nvim/lazy/nvim-treesitter/queries/vimdoc/injections.scm", failed to load: ...nux64/share/nvim/runtime/lua/vim/treesitter/language.lua:112: Failed to load parser for language 'vimdoc': uv_dlopen: no error

解决方案

1. 修复NvChad配置目录权限

WSL环境下,文件权限异常会导致动态库加载失败,执行以下命令修复:

sudo chown -R $USER:$USER ~/.local/share/nvim/
sudo chmod -R 755 ~/.local/share/nvim/

修复后重新安装解析器:

:TSInstall lua luadoc printf vim vimdoc odin

2. 安装Treesitter编译依赖

Ubuntu 24.04默认缺少部分编译工具,导致解析器编译不完整:

sudo apt update && sudo apt install build-essential cmake git

卸载现有解析器后重新安装:

:TSUninstall all
:TSInstall all

3. 切换Neovim稳定版

部分WSL环境下,最新版Neovim与Treesitter存在兼容性问题,降级到0.9.x稳定版:

# 卸载当前版本
sudo apt remove neovim
# 添加稳定版PPA并安装
sudo add-apt-repository ppa:neovim-ppa/stable
sudo apt update && sudo apt install neovim

同步NvChad配置:

:Lazy sync

4. 排查自定义配置干扰

暂时移除自定义配置目录(先备份):

mv ~/.config/nvim/lua/custom/ ~/.config/nvim/lua/custom_backup/

重启Neovim后测试解析器是否正常加载。若恢复正常,逐步恢复自定义配置项,定位问题来源。

5. 切换到WSL2

WSL1在动态库加载上存在限制,确认当前WSL版本:

wsl --list --verbose

若为WSL1,执行以下命令切换到WSL2:

wsl --set-version Ubuntu-24.04 2

重启WSL后重试。

内容的提问来源于stack exchange,提问作者Patrik Holub

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.19 08:45:55