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

Neovim配置加载失败,telescope.builtin模块缺失问题求助

Neovim配置加载失败,Telescope模块找不到

错误详情

打开Neovim时弹出以下错误:

Error detected while processing /home/garamog/dotfiles/nvim/.config/nvim/init.lua:                                                      
E5113: Error while calling lua chunk: /home/garamog/.config/nvim/lua/garamog/remaps.lua:46: module 'telescope.builtin' not found:       
        no field package.preload['telescope.builtin']                                                                                   
        no file './telescope/builtin.lua'                                                                                               
        no file '/usr/share/luajit-2.1/telescope/builtin.lua'                                                                           
        no file '/usr/local/share/lua/5.1/telescope/builtin.lua'                                                                        
        no file '/usr/local/share/lua/5.1/telescope/builtin/init.lua'                                                                   
        no file '/usr/share/lua/5.1/telescope/builtin.lua'                                                                              
        no file '/usr/share/lua/5.1/telescope/builtin/init.lua'                                                                         
        no file './telescope/builtin.so'                                                                                                
        no file '/usr/local/lib/lua/5.1/telescope/builtin.so'                                                                           
        no file '/usr/lib64/lua/5.1/telescope/builtin.so'                                                                               
        no file '/usr/local/lib/lua/5.1/loadall.so'                                                                                     
        no file './telescope.so'                                                                                                        
        no file '/usr/local/lib/lua/5.1/telescope.so'                                                                                   
        no file '/usr/lib64/lua/5.1/telescope.so'                                                                                       
        no file '/usr/local/lib/lua/5.1/loadall.so'                                                                                     
stack traceback:                                                                                                                        
        [C]: in function 'require'                                                                                                      
        /home/garamog/.config/nvim/lua/garamog/remaps.lua:46: in main chunk                                                             
        [C]: in function 'require'                                                                                                      
        /home/garamog/.config/nvim/lua/garamog/init.lua:1: in main chunk                                                                
        [C]: in function 'require'                                                                                                      
        /home/garamog/dotfiles/nvim/.config/nvim/init.lua:1: in main chunk                                                              
Press ENTER or type command to continue

相关配置片段

~/.config/nvim/lua/garamog/remaps.lua 中引发问题的Telescope映射代码:

------- Telescope Remaps ---------
local builtin = require("telescope.builtin")
map("n", "<C-p>", builtin.find_files, {})
-- map("n", "<leader>fg", builtin.live_grep, {})
map("n", "<leader>fb", builtin.buffers, {})
map("n", "<leader>fh", builtin.help_tags, {})

-- telescope
map("n", "<leader>fw", "<cmd>Telescope live_grep<CR>", { desc = "telescope live grep" })
map("n", "<leader>fb", "<cmd>Telescope buffers<CR>", { desc = "telescope find buffers" })
map("n", "<leader>fh", "<cmd>Telescope help_tags<CR>", { desc = "telescope help page" })
map("n", "<leader>ma", "<cmd>Telescope marks<CR>", { desc = "telescope find marks" })
map("n", "<leader>fo", "<cmd>Telescope oldfiles<CR>", { desc = "telescope find oldfiles" })
map("n", "<leader>fz", "<cmd>Telescope current_buffer_fuzzy_find<CR>", { desc = "telescope find in current buffer" })
map("n", "<leader>cm", "<cmd>Telescope git_commits<CR>", { desc = "telescope git commits" })
map("n", "<leader>gt", "<cmd>Telescope git_status<CR>", { desc = "telescope git status" })
map("n", "<leader>pt", "<cmd>Telescope terms<CR>", { desc = "telescope pick hidden term" })
-- map("n", "<leader>th", "<cmd>Telescope themes<CR>", { desc = "telescope nvchad themes" })
map("n", "<C-p>", "<cmd>Telescope find_files<cr>", { desc = "telescope find files" })
map( "n", "<leader>fa", "<cmd>Telescope find_files follow=true no_ignore=true hidden=true<CR>", { desc = "telescope find all files" })

额外现象与环境信息

  • 删除所有Telescope映射后,配置可正常加载
  • 使用自定义NvChad配置时,配置不加载且无报错;克隆默认NvChad配置仅能加载部分插件
  • 已多次清理~/.local/share/nvim、~/.local/state/nvim、~/.cache等目录
  • 系统:Fedora 40

解决建议

  1. 确认Telescope插件已安装

    • 检查插件管理器(如Lazy.nvim、Packer)的配置文件,确认Telescope已被添加到插件列表
    • 手动执行插件安装命令:Lazy.nvim运行:Lazy install,Packer运行:PackerSync
  2. 调整插件加载顺序

    • 避免在Telescope未初始化时调用require("telescope.builtin"),可将Keymap配置放在插件的config回调中,以Lazy.nvim为例:
      {
        "nvim-telescope/telescope.nvim",
        dependencies = { "nvim-lua/plenary.nvim" },
        config = function()
          local builtin = require("telescope.builtin")
          vim.keymap.set("n", "<C-p>", builtin.find_files, {})
          -- 其他Telescope映射
        end
      }
      
  3. 检查路径与符号链接

    • 确认~/.config/nvim符号链接指向正确,无路径错误
    • 检查Telescope安装目录(通常在~/.local/share/nvim/lazy/telescope.nvim)是否存在且文件完整
  4. 排查NvChad配置冲突

    • 自定义NvChad配置时,确认custom目录结构符合官方要求
    • 逐步禁用自定义配置中的其他插件,排查是否存在插件冲突

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.18 17:02:05