[英]Neovim TreeSitter Returning No C Complier Error
I am very new to neovim and the vim ecosystem.我对 neovim 和 vim 生态系统还很陌生。 I am still trying to get started with my own config file, however, I am running into an issue when downloading Kickstart from https://github.com/nvim-lua/kickstart.nvim .我仍在尝试使用自己的配置文件开始,但是,从https://github.com/nvim-lua/kickstart.nvim下载 Kickstart 时遇到问题。 I copied the init.lua file into my own file and ran it.我将init.lua文件复制到我自己的文件中并运行它。 It downloaded all of the correct things, however, there seems to be an issue with the treesitter plugin.它下载了所有正确的东西,但是,treesitter 插件似乎有问题。 When I ran :so
on my init.lua
file, it gave and error.当我在我的init.lua
文件上运行:so
时,它给出了错误。
Re-sourcing your config is not supported with lazy.nvim
Error detected while processing :source (no file):
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
This is my second time trying to deal with treesetter.这是我第二次尝试与 treesetter 打交道。 The first time around I downloaded GCC to try and fix the issue.我第一次下载 GCC 来尝试解决这个问题。 Nothing worked so I decided to delete the whole thing and download kickstart to begin the config process.没有任何效果,所以我决定删除整个东西并下载 kickstart 以开始配置过程。 I need a bit of help with this issue as I am not familiar with Vim yet.我在这个问题上需要一些帮助,因为我还不熟悉 Vim。
Edit: This is the :checkhealth nvim-treesitter
command that gave the following.编辑:这是给出以下内容的:checkhealth nvim-treesitter
命令。
nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
- WARNING: `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK: `node` found v16.14.2 (only needed for :TSInstallFromGrammar)
- OK: `git` executable found.
- OK: `gcc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
Version: gcc (MinGW.org GCC-6.3.0-1) 6.3.0
- OK: Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.
## OS Info:
{
machine = "x86_64",
release = "10.0.22621",
sysname = "Windows_NT",
version = "Windows 10 Home"
}
## Parser/Features H L F I J
- c x x x x x
- cpp x x x x x
- go x x x x x
- help x . . . x
- javascript x x x x x
- lua x x x x x
- python x x x x x
- rust x x x x x
- tsx x x x x x
- typescript x x x x x
- vim x x x . x
Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
+) multiple parsers found, only one will be used
x) errors found in the query, try to run :TSUpdate {lang}
## The following errors have been detected:
- ERROR: c(highlights): Failed to load parser: uv_dlopen: C:\Users\sadda\AppData\Local\nvim-data\lazy\nvim-treesitter\parser\c.so is not a valid Win32 application.
c(highlights) is concatenated from the following files:
| [ERROR]:"C:\Users\sadda\AppData\Local\nvim-data\lazy\nvim-treesitter\queries\c\highlights.scm", failed to load: Failed to load parser: uv_dlopen: C:\Users\sadda\AppData\Local\nvim-data\lazy\nvim-treesitter\parser\c.so is not a valid Win32 application.
- ERROR: c(locals): Failed to load parser: uv_dlopen: C:\Users\sadda\AppData\Local\nvim-data\lazy\nvim-treesitter\parser\c.so is not a valid Win32 application.
As you can see, gcc is available, so I am not sure why this is not working.如您所见,gcc 可用,所以我不确定为什么这不起作用。
Tree-sitter needs to locate correct libraries such as "libstdc++-6.dll" among others. Tree-sitter 需要找到正确的库,例如“libstdc++-6.dll”等。 Such dll files are included in Neovim directory.这样的 dll 个文件包含在 Neovim 目录中。 To ensure that Tree-sitter correctly locates correct version of libraries, modify your system's Path environment variable so that the path to Neovim is above other paths that might have dll files.为确保 Tree-sitter 正确定位库的正确版本,请修改系统的 Path 环境变量,以便 Neovim 的路径高于其他可能包含 dll 个文件的路径。
To do that, follow the instructions below:为此,请按照以下说明操作:
sysdm.cpl,3
输入sysdm.cpl,3
Path
variable with some values in it.在用户变量下,应该有一个Path
变量,其中包含一些值。Path
variable双击Path
变量:TSUpdate all
inside Neovim to recompile Tree-sitter parsers.现在在 Neovim 中执行:TSUpdate all
以重新编译 Tree-sitter 解析器。I had this issue and I found the easiest fix from this article.我遇到了这个问题,我从这篇文章中找到了最简单的修复方法。
https://blog.nikfp.com/how-to-install-and-set-up-neovim-on-windows https://blog.nikfp.com/how-to-install-and-set-up-neovim-on-windows
Like the error says you need to install cc, gcc, clang or zig.就像错误说的那样,您需要安装 cc、gcc、clang 或 zig。 Zig is the easiest for Windows.对于 Windows,Zig 是最简单的。
If you have choclatey installed it is super easy,如果你安装了 choclatey 那就超级简单了,
choco install zig
If you don't have it you can install it from their site.如果你没有它,你可以从他们的网站安装它。
https://ziglang.org/learn/getting-started/ https://ziglang.org/learn/getting-started/
Run Neovim again and the error goes away.再次运行 Neovim,错误消失。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.