Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nimlsp failed to install #787

Closed
1 task done
kwsp opened this issue Dec 22, 2022 · 4 comments
Closed
1 task done

nimlsp failed to install #787

kwsp opened this issue Dec 22, 2022 · 4 comments

Comments

@kwsp
Copy link

kwsp commented Dec 22, 2022

I've searched open issues for similar requests

Yes

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

  • Yes

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 [email protected]
          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 [email protected]
       Installing ast_pattern_matching@any version
      Downloading https://github.com/nim-lang/ast-pattern-matching using git
        Verifying dependencies for [email protected]
       Installing [email protected]
         Success: ast_pattern_matching installed successfully.
       Installing [email protected]
         Success: jsonschema installed successfully.
       Installing asynctools@any version
      Downloading https://github.com/cheatfate/asynctools using git
        Verifying dependencies for [email protected]
       Installing [email protected]
         Success: asynctools installed successfully.
         Building nimlsp/nimlsp using c backend
      �[1m/Users/tnie/.local/share/nvim/mason/.packages/nimlsp/src/nimlsppkg/baseprotocol.nim(2, 8) �[0m�[33mWarning: �[0mimported and not used: 'logger'�[36m [UnusedImport]�[0m�[0m
      �[1m/Users/tnie/.local/share/nvim/mason/.packages/nimlsp/src/nimlsppkg/suggestlib.nim(11, 8) �[0mtemplate/generic instantiation of `mImport` from here�[0m
      �[1m/Users/tnie/.local/share/nvim/mason/.packages/nimlsp/src/nimlsppkg/suggestlib.nim(7, 14) �[0m�[31mError: �[0mcannot open file: /opt/homebrew/Cellar/nim/1.6.10/nim/nimsuggest/nimsuggest.nim�[36m�[0m�[0m
             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 [email protected]

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
Copy link

jvinet commented Dec 26, 2022

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
Copy link
Owner

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
Copy link
Author

kwsp commented Jan 5, 2023

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?

@kwsp kwsp closed this as completed Jan 5, 2023
@ShortArrow
Copy link

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😄.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants