williamboman / mason.nvim

Portable package manager for Neovim that runs everywhere Neovim runs. Easily install and manage LSP servers, DAP servers, linters, and formatters.
Apache License 2.0
7.62k stars 270 forks source link

`nimlsp` failed to install #787

Closed kwsp closed 1 year ago

kwsp commented 1 year ago

I've searched open issues for similar requests

Yes

I've recently downloaded the latest plugin version of mason.nvim

Problem description

Trying to install nimlsp fails.

The error message is a bit cryptic and its hard to debug off of the error message.

Expected behavior

nimlsp should install successfully, as I have all the tools required to compile nim code installed.

Affected packages

nimlsp

Mason output

Failed
    ◍ nimlsp
      Cloning into '.'...
      From https://github.com/PMunch/nimlsp
       * tag               v0.4.1     -> FETCH_HEAD
      Note: switching to 'FETCH_HEAD'.

      You are in 'detached HEAD' state. You can look around, make experimental
      changes and commit them, and you can discard any commits you make in this
      state without impacting any branches by switching back to a branch.

      If you want to create a new branch to retain commits you create, you may
      do so (now or later) by using -c with the switch command. Example:

        git switch -c <new-branch-name>

      Or undo this operation with:

        git switch -

      Turn off this advice by setting config variable advice.detachedHead to false

      HEAD is now at fa1e975 Bump version
         Warning: Using project local deps mode
        Verifying dependencies for nimlsp@0.4.1
          Prompt: No local packages.json found, download it from internet? -> [forced yes]
      Downloading Official package list
          Success Package list downloaded.
       Installing jsonschema@>= 0.2.1
      Downloading https://github.com/PMunch/jsonschema using git
        Verifying dependencies for jsonschema@0.2.1
       Installing ast_pattern_matching@any version
      Downloading https://github.com/nim-lang/ast-pattern-matching using git
        Verifying dependencies for ast_pattern_matching@1.0.0
       Installing ast_pattern_matching@1.0.0
         Success: ast_pattern_matching installed successfully.
       Installing jsonschema@0.2.1
         Success: jsonschema installed successfully.
       Installing asynctools@any version
      Downloading https://github.com/cheatfate/asynctools using git
        Verifying dependencies for asynctools@0.1.1
       Installing asynctools@0.1.1
         Success: asynctools installed successfully.
         Building nimlsp/nimlsp using c backend
      /Users/tnie/.local/share/nvim/mason/.packages/nimlsp/src/nimlsppkg/baseprotocol.nim(2, 8) Warning: imported and not used: 'logger' [UnusedImport]
      /Users/tnie/.local/share/nvim/mason/.packages/nimlsp/src/nimlsppkg/suggestlib.nim(11, 8) template/generic instantiation of `mImport` from here
      /Users/tnie/.local/share/nvim/mason/.packages/nimlsp/src/nimlsppkg/suggestlib.nim(7, 14) Error: cannot open file: /opt/homebrew/Cellar/nim/1.6.10/nim/nimsuggest/nimsuggest.nim
             Tip: 33 messages have been suppressed, use --verbose to show them.
           Error: Build failed for package: nimlsp
              ... Execution failed with exit code 256
              ... Command: /opt/homebrew/Cellar/nim/1.6.10/nim/bin/nim c --colors:on --noNimblePath -d:NimblePkgVersion=0.4.1 --path:/Users/tnie/.local/share/nvim/mason/.packages/nimlsp/nimbledeps/pkgs/ast_pattern_matching-1.0.0 --path:/Users/tnie/.local/share/nvim/mason/.packages/nimlsp/nimbledeps/pkgs/jsonschema-0.2.1 --path:/Users/tnie/.local/share/nvim/mason/.packages/nimlsp/nimbledeps/pkgs/asynctools-0.1.1 --hints:off -o:/Users/tnie/.local/share/nvim/mason/.packages/nimlsp/nimlsp /Users/tnie/.local/share/nvim/mason/.packages/nimlsp/src/nimlsp.nim
      spawn: nimble failed with exit code 1 and signal 0.

Installation log

[INFO  Thu Dec 22 10:16:22 2022] ...acker/start/mason.nvim/lua/mason-core/installer/init.lua:110: Executing installer for Package(name=nimlsp)
[DEBUG Thu Dec 22 10:16:22 2022] .../site/pack/packer/start/mason.nvim/lua/mason-core/fs.lua:71: fs: mkdirp /Users/tnie/.local/share/nvim/mason/.packages/nimlsp
[DEBUG Thu Dec 22 10:16:22 2022] ...te/pack/packer/start/mason.nvim/lua/mason-core/fetch.lua:32: Fetching URL "https://api.mason-registry.dev/api/repo/PMunch/nimlsp/tags/latest"
[DEBUG Thu Dec 22 10:16:22 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="curl", spawn_opts={
  args = { "-H", "Accept: application/vnd.mason-registry.v1+json; q=1.0, application/json; q=0.8", "-H", "User-Agent: mason.nvim (+https://github.com/williamboman/mason.nvim)", "-fsSL", "-X", "GET", "https://api.mason-registry.dev/api/repo/PMunch/nimlsp/tags/latest" }
}
[DEBUG Thu Dec 22 10:16:22 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 59782
[DEBUG Thu Dec 22 10:16:22 2022] ...te/pack/packer/start/mason.nvim/lua/mason-core/fetch.lua:32: Fetching URL "https://api.mason-registry.dev/api/repo/clangd/clangd/releases/latest?include_prerelease=false"
[DEBUG Thu Dec 22 10:16:22 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="curl", spawn_opts={
  args = { "-H", "Accept: application/vnd.mason-registry.v1+json; q=1.0, application/json; q=0.8", "-H", "User-Agent: mason.nvim (+https://github.com/williamboman/mason.nvim)", "-fsSL", "-X", "GET", "https://api.mason-registry.dev/api/repo/clangd/clangd/releases/latest?include_prerelease=false" }
}
[DEBUG Thu Dec 22 10:16:22 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 59787
[DEBUG Thu Dec 22 10:16:22 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="go", spawn_opts={
  args = { "list", "-json", "-m", "golang.org/x/tools/gopls@latest" },
  cwd = "/Users/tnie/.local/share/nvim/mason/packages/gopls"
}
[DEBUG Thu Dec 22 10:16:22 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 59789
[DEBUG Thu Dec 22 10:16:22 2022] ...te/pack/packer/start/mason.nvim/lua/mason-core/fetch.lua:32: Fetching URL "https://api.mason-registry.dev/api/repo/sumneko/vscode-lua/releases/latest?include_prerelease=false"
[DEBUG Thu Dec 22 10:16:22 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="curl", spawn_opts={
  args = { "-H", "Accept: application/vnd.mason-registry.v1+json; q=1.0, application/json; q=0.8", "-H", "User-Agent: mason.nvim (+https://github.com/williamboman/mason.nvim)", "-fsSL", "-X", "GET", "https://api.mason-registry.dev/api/repo/sumneko/vscode-lua/releases/latest?include_prerelease=false" }
}
[DEBUG Thu Dec 22 10:16:22 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 59794
[DEBUG Thu Dec 22 10:16:22 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="npm", spawn_opts={
  args = { "ls", "--json" },
  cwd = "/Users/tnie/.local/share/nvim/mason/packages/pyright"
}
[DEBUG Thu Dec 22 10:16:22 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 59796
[DEBUG Thu Dec 22 10:16:22 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:148: Job pid=59794 exited with exit_code=0, signal=0
[DEBUG Thu Dec 22 10:16:22 2022] ...tart/mason.nvim/lua/mason-core/package/version-check.lua:72: Version check failed ...start/mason.nvim/lua/mason-core/managers/github/init.lua:177: Primary package is not outdated.
[DEBUG Thu Dec 22 10:16:22 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:148: Job pid=59787 exited with exit_code=0, signal=0
[DEBUG Thu Dec 22 10:16:22 2022] ...tart/mason.nvim/lua/mason-core/package/version-check.lua:72: Version check failed ...start/mason.nvim/lua/mason-core/managers/github/init.lua:177: Primary package is not outdated.
[DEBUG Thu Dec 22 10:16:22 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:148: Job pid=59782 exited with exit_code=0, signal=0
[DEBUG Thu Dec 22 10:16:22 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="git", spawn_opts={
  args = { "clone", "--depth", "1", "https://github.com/PMunch/nimlsp", "." },
  cwd = "/Users/tnie/.local/share/nvim/mason/.packages/nimlsp"
}
[DEBUG Thu Dec 22 10:16:22 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 59801
[DEBUG Thu Dec 22 10:16:23 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:148: Job pid=59789 exited with exit_code=0, signal=0
[DEBUG Thu Dec 22 10:16:23 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="go", spawn_opts={
  args = { "version", "-m", "gopls" },
  cwd = "/Users/tnie/.local/share/nvim/mason/packages/gopls"
}
[DEBUG Thu Dec 22 10:16:23 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 59805
[DEBUG Thu Dec 22 10:16:23 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:148: Job pid=59805 exited with exit_code=0, signal=0
[DEBUG Thu Dec 22 10:16:23 2022] ...tart/mason.nvim/lua/mason-core/package/version-check.lua:69: Version check {
  current_version = "v0.10.1",
  latest_version = "v0.11.0",
  name = "golang.org/x/tools/gopls"
}
[DEBUG Thu Dec 22 10:16:23 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:148: Job pid=59801 exited with exit_code=0, signal=0
[DEBUG Thu Dec 22 10:16:23 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="git", spawn_opts={
  args = { "fetch", "--depth", "1", "origin", "v0.4.1" },
  cwd = "/Users/tnie/.local/share/nvim/mason/.packages/nimlsp"
}
[DEBUG Thu Dec 22 10:16:23 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 59812
[DEBUG Thu Dec 22 10:16:23 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:148: Job pid=59796 exited with exit_code=0, signal=0
[DEBUG Thu Dec 22 10:16:23 2022] ...te/pack/packer/start/mason.nvim/lua/mason-core/fetch.lua:32: Fetching URL "https://api.mason-registry.dev/api/npm/pyright/versions/latest"
[DEBUG Thu Dec 22 10:16:23 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="curl", spawn_opts={
  args = { "-H", "Accept: application/vnd.mason-registry.v1+json; q=1.0, application/json; q=0.8", "-H", "User-Agent: mason.nvim (+https://github.com/williamboman/mason.nvim)", "-fsSL", "-X", "GET", "https://api.mason-registry.dev/api/npm/pyright/versions/latest" }
}
[DEBUG Thu Dec 22 10:16:23 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 59819
[DEBUG Thu Dec 22 10:16:23 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:148: Job pid=59819 exited with exit_code=0, signal=0
[DEBUG Thu Dec 22 10:16:23 2022] ...tart/mason.nvim/lua/mason-core/package/version-check.lua:72: Version check failed Primary package is not outdated.
[DEBUG Thu Dec 22 10:16:24 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:148: Job pid=59812 exited with exit_code=0, signal=0
[DEBUG Thu Dec 22 10:16:24 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="git", spawn_opts={
  args = { "checkout", "FETCH_HEAD" },
  cwd = "/Users/tnie/.local/share/nvim/mason/.packages/nimlsp"
}
[DEBUG Thu Dec 22 10:16:24 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 59827
[DEBUG Thu Dec 22 10:16:24 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:148: Job pid=59827 exited with exit_code=0, signal=0
[DEBUG Thu Dec 22 10:16:24 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="nimble", spawn_opts={
  args = { "build", "-y", "--localdeps" },
  cwd = "/Users/tnie/.local/share/nvim/mason/.packages/nimlsp"
}
[DEBUG Thu Dec 22 10:16:24 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 59829
[DEBUG Thu Dec 22 10:16:31 2022] .../pack/packer/start/mason.nvim/lua/mason-core/process.lua:148: Job pid=59829 exited with exit_code=1, signal=0
[ERROR Thu Dec 22 10:16:31 2022] ...acker/start/mason.nvim/lua/mason-core/installer/init.lua:146: Installation failed for Package(name=nimlsp) error=spawn: nimble failed with exit code 1 and signal 0. 
[DEBUG Thu Dec 22 10:16:31 2022] .../site/pack/packer/start/mason.nvim/lua/mason-core/fs.lua:47: fs: rmrf /Users/tnie/.local/share/nvim/mason/.packages/nimlsp
[DEBUG Thu Dec 22 10:16:31 2022] ...ker/start/mason.nvim/lua/mason-core/installer/linker.lua:21: Unlinking Package(name=nimlsp)

Neovim version (>= 0.7)

NVIM v0.8.1 Build type: Release LuaJIT 2.1.0-beta3 Compiled by brew@HMBRW-A-001-M1-004.local

Operating system/version

Darwin Silvie-2.local 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101 arm64

Healthcheck

mason: require("mason.health").check()
========================================================================
## mason.nvim report
  - OK: neovim version >= 0.7.0
  - OK: **Go**: `go version go1.19.4 darwin/arm64`
  - OK: **cargo**: `cargo 1.64.0 (387270bc7 2022-09-16)`
  - WARNING: **luarocks**: not available
  - OK: **Ruby**: `ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]`
  - OK: **RubyGem**: `3.0.3.1`
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - OK: **npm**: `9.2.0`
  - OK: **node**: `v19.3.0`
  - OK: **python3**: `Python 3.10.9`
  - OK: **pip3**: `pip 22.3.1 from /opt/homebrew/lib/python3.10/site-packages/pip (python 3.10)`
  - OK: **javac**: `javac 19.0.1`
  - OK: **java**: `openjdk version "19.0.1" 2022-10-18`
  - WARNING: **julia**: not available
  - OK: **wget**: `GNU Wget 1.21.3 built on darwin21.3.0.`
  - OK: **curl**: `curl 7.79.1 (x86_64-apple-darwin21.0) libcurl/7.79.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.45.1`
  - OK: **gzip**: `Apple gzip 353.100.22`
  - OK: **tar**: `bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8 `
  - OK: **bash**: `GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)`
  - OK: **sh**: `Ok`
  - OK: GitHub API rate limit. Used: 0. Remaining: 5000. Limit: 5000. Reset: Thu Dec 22 11:19:47 2022.

Screenshots

No response

jvinet commented 1 year ago

This is likely happening because Nim was installed via a package manager which does not include the Nim source code. The source is required for NimLSP to build.

Solution (for me) was to install Nim using choosenim, which will keep the sources on-disk for NimLSP to find.

See also:

williamboman commented 1 year ago

Thanks @jvinet! I personally don't do Nim development so I'm afraid I'm a bit lost. I can install nimlsp via Mason just fine on 3 different Macs. My experience so far with nim has been that choosenim is essentially a must for building nim packages, as it provides some essentials.

kwsp commented 1 year ago

This fixes the problem! I originally installed nim with brew without choosenim. After uninstalling the nim from brew and installing choosenim, I was able to install nimlsp successfully.

I think this should be documented somewhere - that nimlsp won't install if you don't have choosenim available. Maybe in the README of https://github.com/williamboman/mason-lspconfig.nvim#available-lsp-servers?

ShortArrow commented 1 year ago

I faced the same problem. Because I was installed nim by pacman on Archlinux, Like sudo pacman -S nim. So, My problem was fixed by reinstall with curl https://nim-lang.org/choosenim/init.sh -sSf | sh. This page was helpful for me. Thank you😄.